This repository has been archived by the owner on Feb 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16.8k
/
agent-clusterchecks-deployment.yaml
126 lines (126 loc) · 5.01 KB
/
agent-clusterchecks-deployment.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
{{- if and .Values.clusterAgent.enabled .Values.clusterAgent.clusterChecks.enabled .Values.clusterchecksDeployment.enabled -}}
{{- if .Capabilities.APIVersions.Has "apps/v1" }}
apiVersion: apps/v1
{{- else if .Capabilities.APIVersions.Has "extensions/v1beta1" }}
apiVersion: extensions/v1beta1
{{- else }}
apiVersion: apps/v1
{{- end }}
kind: Deployment
metadata:
name: {{ template "datadog.fullname" . }}-clusterchecks
labels:
app: "{{ template "datadog.fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
app.kubernetes.io/name: "{{ template "datadog.fullname" . }}"
app.kubernetes.io/instance: {{ .Release.Name | quote }}
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
app.kubernetes.io/version: {{ .Chart.AppVersion }}
spec:
replicas: {{ .Values.clusterchecksDeployment.replicas }}
strategy:
{{- if .Values.clusterchecksDeployment.strategy }}
{{ toYaml .Values.clusterchecksDeployment.strategy | indent 4 }}
{{- else }}
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
{{- end }}
selector:
matchLabels:
app: {{ template "datadog.fullname" . }}-clusterchecks
template:
metadata:
labels:
app: {{ template "datadog.fullname" . }}-clusterchecks
name: {{ template "datadog.fullname" . }}-clusterchecks
spec:
{{- if .Values.clusterchecksDeployment.rbac.dedicated }}
serviceAccountName: {{ if .Values.rbac.create }}{{ template "datadog.fullname" . }}-cluster-checks{{ else }}"{{ .Values.clusterchecksDeployment.rbac.serviceAccountName }}"{{ end }}
{{- else }}
serviceAccountName: {{ if .Values.rbac.create }}{{ template "datadog.fullname" . }}{{ else }}"{{ .Values.rbac.serviceAccountName }}"{{ end }}
{{- end }}
containers:
- name: {{ default .Chart.Name .Values.datadog.name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: DD_API_KEY
valueFrom:
secretKeyRef:
name: {{ template "datadog.apiSecretName" . }}
key: api-key
- name: DD_EXTRA_CONFIG_PROVIDERS
value: "clusterchecks"
- {name: DD_HEALTH_PORT, value: "5555"}
# Cluster checks
- name: DD_CLUSTER_AGENT_KUBERNETES_SERVICE_NAME
value: {{ template "datadog.fullname" . }}-cluster-agent
- name: DD_CLUSTER_AGENT_AUTH_TOKEN
valueFrom:
secretKeyRef:
name: {{ template "clusterAgent.tokenSecretName" . }}
key: token
- name: DD_CLUSTER_AGENT_ENABLED
value: {{ .Values.clusterAgent.enabled | quote }}
- {name: DD_EXTRA_CONFIG_PROVIDERS, value: "clusterchecks"}
# Remove unused features
- {name: DD_APM_ENABLED, value: "false"}
- {name: DD_PROCESS_AGENT_ENABLED, value: "false"}
- {name: DD_LOGS_ENABLED, value: "false"}
# Safely run alongside the daemonset
- {name: DD_ENABLE_METADATA_COLLECTION, value: "false"}
- name: DD_HOSTNAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
{{- if .Values.clusterchecksDeployment.env }}
{{ toYaml .Values.clusterchecksDeployment.env | indent 10 }}
{{- end }}
resources:
{{ toYaml .Values.clusterchecksDeployment.resources | indent 10 }}
volumeMounts:
- {name: s6-run, mountPath: /var/run/s6}
- {name: remove-corechecks, mountPath: /etc/datadog-agent/conf.d}
{{- if .Values.clusterchecksDeployment.livenessProbe }}
livenessProbe:
{{ toYaml .Values.clusterchecksDeployment.livenessProbe | indent 10 }}
{{- else }}
livenessProbe:
httpGet:
path: /health
port: 5555
initialDelaySeconds: 15
periodSeconds: 15
timeoutSeconds: 5
successThreshold: 1
failureThreshold: 6
{{- end }}
volumes:
- {name: s6-run, emptyDir: {}}
- {name: remove-corechecks, emptyDir: {}}
affinity:
{{- if .Values.clusterchecksDeployment.affinity }}
{{ toYaml .Values.clusterchecksDeployment.affinity | indent 8 }}
{{- else }}
# Ensure we only run one worker per node, to avoid name collisions
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchLabels:
app: {{ template "datadog.fullname" . }}-clusterchecks
topologyKey: kubernetes.io/hostname
{{- end }}
{{- if .Values.clusterchecksDeployment.nodeSelector }}
nodeSelector:
{{ toYaml .Values.clusterchecksDeployment.nodeSelector | indent 8 }}
{{- end }}
{{- if .Values.clusterchecksDeployment.tolerations }}
tolerations:
{{ toYaml .Values.clusterchecksDeployment.tolerations | indent 8 }}
{{- end }}
{{ end }}