github.com/verrazzano/verrazzano@v1.7.0/platform-operator/thirdparty/charts/prometheus-community/prometheus-node-exporter/templates/daemonset.yaml (about) 1 apiVersion: apps/v1 2 kind: DaemonSet 3 metadata: 4 name: {{ include "prometheus-node-exporter.fullname" . }} 5 namespace: {{ include "prometheus-node-exporter.namespace" . }} 6 labels: 7 {{- include "prometheus-node-exporter.labels" . | nindent 4 }} 8 {{- with .Values.daemonsetAnnotations }} 9 annotations: 10 {{- toYaml . | nindent 4 }} 11 {{- end }} 12 spec: 13 selector: 14 matchLabels: 15 {{- include "prometheus-node-exporter.selectorLabels" . | nindent 6 }} 16 revisionHistoryLimit: {{ .Values.revisionHistoryLimit }} 17 {{- with .Values.updateStrategy }} 18 updateStrategy: 19 {{- toYaml . | nindent 4 }} 20 {{- end }} 21 template: 22 metadata: 23 {{- with .Values.podAnnotations }} 24 annotations: 25 {{- toYaml . | nindent 8 }} 26 {{- end }} 27 labels: 28 {{- include "prometheus-node-exporter.labels" . | nindent 8 }} 29 spec: 30 automountServiceAccountToken: {{ ternary true false (or .Values.serviceAccount.automountServiceAccountToken .Values.kubeRBACProxy.enabled) }} 31 {{- with .Values.securityContext }} 32 securityContext: 33 {{- toYaml . | nindent 8 }} 34 {{- end }} 35 {{- with .Values.priorityClassName }} 36 priorityClassName: {{ . }} 37 {{- end }} 38 {{- with .Values.extraInitContainers }} 39 initContainers: 40 {{- toYaml . | nindent 8 }} 41 {{- end }} 42 serviceAccountName: {{ include "prometheus-node-exporter.serviceAccountName" . }} 43 containers: 44 {{- $servicePort := ternary 8100 .Values.service.port .Values.kubeRBACProxy.enabled }} 45 - name: node-exporter 46 image: {{ include "prometheus-node-exporter.image" . }} 47 imagePullPolicy: {{ .Values.image.pullPolicy }} 48 args: 49 - --path.procfs=/host/proc 50 - --path.sysfs=/host/sys 51 {{- if .Values.hostRootFsMount.enabled }} 52 - --path.rootfs=/host/root 53 {{- if semverCompare ">=1.4.0" (default .Chart.AppVersion .Values.image.tag) }} 54 - --path.udev.data=/host/root/run/udev/data 55 {{- end }} 56 {{- end }} 57 - --web.listen-address=[$(HOST_IP)]:{{ $servicePort }} 58 {{- with .Values.extraArgs }} 59 {{- toYaml . | nindent 12 }} 60 {{- end }} 61 {{- with .Values.containerSecurityContext }} 62 securityContext: 63 {{- toYaml . | nindent 12 }} 64 {{- end }} 65 env: 66 - name: HOST_IP 67 {{- if .Values.kubeRBACProxy.enabled }} 68 value: 127.0.0.1 69 {{- else if .Values.service.listenOnAllInterfaces }} 70 value: 0.0.0.0 71 {{- else }} 72 valueFrom: 73 fieldRef: 74 apiVersion: v1 75 fieldPath: status.hostIP 76 {{- end }} 77 {{- range $key, $value := .Values.env }} 78 - name: {{ $key }} 79 value: {{ $value | quote }} 80 {{- end }} 81 {{- if eq .Values.kubeRBACProxy.enabled false }} 82 ports: 83 - name: {{ .Values.service.portName }} 84 containerPort: {{ .Values.service.port }} 85 protocol: TCP 86 {{- end }} 87 livenessProbe: 88 failureThreshold: {{ .Values.livenessProbe.failureThreshold }} 89 httpGet: 90 {{- if .Values.kubeRBACProxy.enabled }} 91 host: 127.0.0.1 92 {{- end }} 93 httpHeaders: 94 {{- range $_, $header := .Values.livenessProbe.httpGet.httpHeaders }} 95 - name: {{ $header.name }} 96 value: {{ $header.value }} 97 {{- end }} 98 path: / 99 port: {{ $servicePort }} 100 scheme: {{ upper .Values.livenessProbe.httpGet.scheme }} 101 initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} 102 periodSeconds: {{ .Values.livenessProbe.periodSeconds }} 103 successThreshold: {{ .Values.livenessProbe.successThreshold }} 104 timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} 105 readinessProbe: 106 failureThreshold: {{ .Values.readinessProbe.failureThreshold }} 107 httpGet: 108 {{- if .Values.kubeRBACProxy.enabled }} 109 host: 127.0.0.1 110 {{- end }} 111 httpHeaders: 112 {{- range $_, $header := .Values.readinessProbe.httpGet.httpHeaders }} 113 - name: {{ $header.name }} 114 value: {{ $header.value }} 115 {{- end }} 116 path: / 117 port: {{ $servicePort }} 118 scheme: {{ upper .Values.readinessProbe.httpGet.scheme }} 119 initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} 120 periodSeconds: {{ .Values.readinessProbe.periodSeconds }} 121 successThreshold: {{ .Values.readinessProbe.successThreshold }} 122 timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} 123 {{- with .Values.resources }} 124 resources: 125 {{- toYaml . | nindent 12 }} 126 {{- end }} 127 volumeMounts: 128 - name: proc 129 mountPath: /host/proc 130 readOnly: true 131 - name: sys 132 mountPath: /host/sys 133 readOnly: true 134 {{- if .Values.hostRootFsMount.enabled }} 135 - name: root 136 mountPath: /host/root 137 {{- with .Values.hostRootFsMount.mountPropagation }} 138 mountPropagation: {{ . }} 139 {{- end }} 140 readOnly: true 141 {{- end }} 142 {{- range $_, $mount := .Values.extraHostVolumeMounts }} 143 - name: {{ $mount.name }} 144 mountPath: {{ $mount.mountPath }} 145 readOnly: {{ $mount.readOnly }} 146 {{- with $mount.mountPropagation }} 147 mountPropagation: {{ . }} 148 {{- end }} 149 {{- end }} 150 {{- range $_, $mount := .Values.sidecarVolumeMount }} 151 - name: {{ $mount.name }} 152 mountPath: {{ $mount.mountPath }} 153 readOnly: true 154 {{- end }} 155 {{- range $_, $mount := .Values.configmaps }} 156 - name: {{ $mount.name }} 157 mountPath: {{ $mount.mountPath }} 158 {{- end }} 159 {{- range $_, $mount := .Values.secrets }} 160 - name: {{ .name }} 161 mountPath: {{ .mountPath }} 162 {{- end }} 163 {{- with .Values.sidecars }} 164 {{- toYaml . | nindent 8 }} 165 {{- if or $.Values.sidecarVolumeMount $.Values.sidecarHostVolumeMounts }} 166 volumeMounts: 167 {{- range $_, $mount := $.Values.sidecarVolumeMount }} 168 - name: {{ $mount.name }} 169 mountPath: {{ $mount.mountPath }} 170 readOnly: {{ $mount.readOnly }} 171 {{- end }} 172 {{- range $_, $mount := $.Values.sidecarHostVolumeMounts }} 173 - name: {{ $mount.name }} 174 mountPath: {{ $mount.mountPath }} 175 readOnly: {{ $mount.readOnly }} 176 {{- if $mount.mountPropagation }} 177 mountPropagation: {{ $mount.mountPropagation }} 178 {{- end }} 179 {{- end }} 180 {{- end }} 181 {{- end }} 182 {{- if .Values.kubeRBACProxy.enabled }} 183 - name: kube-rbac-proxy 184 args: 185 {{- if .Values.kubeRBACProxy.extraArgs }} 186 {{- .Values.kubeRBACProxy.extraArgs | toYaml | nindent 12 }} 187 {{- end }} 188 - --secure-listen-address=:{{ .Values.service.port}} 189 - --upstream=http://127.0.0.1:{{ $servicePort }}/ 190 - --proxy-endpoints-port=8888 191 - --config-file=/etc/kube-rbac-proxy-config/config-file.yaml 192 volumeMounts: 193 - name: kube-rbac-proxy-config 194 mountPath: /etc/kube-rbac-proxy-config 195 imagePullPolicy: {{ .Values.kubeRBACProxy.image.pullPolicy }} 196 {{- if .Values.kubeRBACProxy.image.sha }} 197 image: "{{ .Values.global.imageRegistry | default .Values.kubeRBACProxy.image.registry}}/{{ .Values.kubeRBACProxy.image.repository }}:{{ .Values.kubeRBACProxy.image.tag }}@sha256:{{ .Values.kubeRBACProxy.image.sha }}" 198 {{- else }} 199 image: "{{ .Values.global.imageRegistry | default .Values.kubeRBACProxy.image.registry}}/{{ .Values.kubeRBACProxy.image.repository }}:{{ .Values.kubeRBACProxy.image.tag }}" 200 {{- end }} 201 ports: 202 - containerPort: {{ .Values.service.port}} 203 name: "http" 204 - containerPort: 8888 205 name: "http-healthz" 206 readinessProbe: 207 httpGet: 208 scheme: HTTPS 209 port: 8888 210 path: healthz 211 initialDelaySeconds: 5 212 timeoutSeconds: 5 213 {{- if .Values.kubeRBACProxy.resources }} 214 resources: 215 {{ toYaml .Values.kubeRBACProxy.resources | nindent 12 }} 216 {{- end }} 217 {{- if .Values.kubeRBACProxy.containerSecurityContext }} 218 securityContext: 219 {{ toYaml .Values.kubeRBACProxy.containerSecurityContext | nindent 12 }} 220 {{- end }} 221 {{- end }} 222 {{- if or .Values.imagePullSecrets .Values.global.imagePullSecrets }} 223 imagePullSecrets: 224 {{- include "prometheus-node-exporter.imagePullSecrets" (dict "Values" .Values "imagePullSecrets" .Values.imagePullSecrets) | indent 8 }} 225 {{- end }} 226 hostNetwork: {{ .Values.hostNetwork }} 227 hostPID: {{ .Values.hostPID }} 228 {{- with .Values.affinity }} 229 affinity: 230 {{- toYaml . | nindent 8 }} 231 {{- end }} 232 {{- with .Values.dnsConfig }} 233 dnsConfig: 234 {{- toYaml . | nindent 8 }} 235 {{- end }} 236 {{- with .Values.nodeSelector }} 237 nodeSelector: 238 {{- toYaml . | nindent 8 }} 239 {{- end }} 240 {{- with .Values.tolerations }} 241 tolerations: 242 {{- toYaml . | nindent 8 }} 243 {{- end }} 244 volumes: 245 - name: proc 246 hostPath: 247 path: /proc 248 - name: sys 249 hostPath: 250 path: /sys 251 {{- if .Values.hostRootFsMount.enabled }} 252 - name: root 253 hostPath: 254 path: / 255 {{- end }} 256 {{- range $_, $mount := .Values.extraHostVolumeMounts }} 257 - name: {{ $mount.name }} 258 hostPath: 259 path: {{ $mount.hostPath }} 260 {{- end }} 261 {{- range $_, $mount := .Values.sidecarVolumeMount }} 262 - name: {{ $mount.name }} 263 emptyDir: 264 medium: Memory 265 {{- end }} 266 {{- range $_, $mount := .Values.sidecarHostVolumeMounts }} 267 - name: {{ $mount.name }} 268 hostPath: 269 path: {{ $mount.hostPath }} 270 {{- end }} 271 {{- range $_, $mount := .Values.configmaps }} 272 - name: {{ $mount.name }} 273 configMap: 274 name: {{ $mount.name }} 275 {{- end }} 276 {{- range $_, $mount := .Values.secrets }} 277 - name: {{ $mount.name }} 278 secret: 279 secretName: {{ $mount.name }} 280 {{- end }} 281 {{- if .Values.kubeRBACProxy.enabled }} 282 - name: kube-rbac-proxy-config 283 configMap: 284 name: {{ template "prometheus-node-exporter.fullname" . }}-rbac-config 285 {{- end }}