{{ if .Values.global.prometheus.enabled }} {{- if .Values.prometheus.nodeExporter.enabled -}} apiVersion: apps/v1 kind: DaemonSet metadata: {{- if .Values.prometheus.nodeExporter.deploymentAnnotations }} annotations: {{ toYaml .Values.prometheus.nodeExporter.deploymentAnnotations | indent 4 }} {{- end }} labels: {{- include "prometheus.nodeExporter.labels" . | nindent 4 }} name: {{ template "prometheus.nodeExporter.fullname" . }} namespace: {{ .Release.Namespace }} spec: selector: matchLabels: {{- include "prometheus.nodeExporter.matchLabels" . | nindent 6 }} {{- if .Values.prometheus.nodeExporter.updateStrategy }} updateStrategy: {{ toYaml .Values.prometheus.nodeExporter.updateStrategy | indent 4 }} {{- end }} template: metadata: {{- if .Values.prometheus.nodeExporter.podAnnotations }} annotations: {{ toYaml .Values.prometheus.nodeExporter.podAnnotations | indent 8 }} {{- end }} labels: {{- include "prometheus.nodeExporter.labels" . | nindent 8 }} {{- if .Values.prometheus.nodeExporter.pod.labels }} {{ toYaml .Values.prometheus.nodeExporter.pod.labels | indent 8 }} {{- end }} spec: {{- if .Values.prometheus.nodeExporter.affinity }} affinity: {{ toYaml .Values.prometheus.nodeExporter.affinity | indent 8 }} {{- end }} serviceAccountName: {{ template "prometheus.serviceAccountName.nodeExporter" . }} {{- if .Values.prometheus.nodeExporter.dnsPolicy }} dnsPolicy: "{{ .Values.prometheus.nodeExporter.dnsPolicy }}" {{- end }} {{- if .Values.prometheus.nodeExporter.priorityClassName }} priorityClassName: "{{ .Values.prometheus.nodeExporter.priorityClassName }}" {{- end }} containers: - name: {{ template "prometheus.name" . }}-{{ .Values.prometheus.nodeExporter.name }} image: "{{ .Values.prometheus.nodeExporter.image.repository }}:{{ .Values.prometheus.nodeExporter.image.tag }}" imagePullPolicy: "{{ .Values.prometheus.nodeExporter.image.pullPolicy }}" args: - --path.procfs=/host/proc - --path.sysfs=/host/sys {{- if .Values.prometheus.nodeExporter.hostNetwork }} - --web.listen-address=:{{ .Values.prometheus.nodeExporter.service.hostPort }} {{- end }} {{- range $key, $value := .Values.prometheus.nodeExporter.extraArgs }} {{- if $value }} - --{{ $key }}={{ $value }} {{- else }} - --{{ $key }} {{- end }} {{- end }} ports: - name: metrics {{- if .Values.prometheus.nodeExporter.hostNetwork }} containerPort: {{ .Values.prometheus.nodeExporter.service.hostPort }} {{- else }} containerPort: 9100 {{- end }} hostPort: {{ .Values.prometheus.nodeExporter.service.hostPort }} resources: {{ toYaml .Values.prometheus.nodeExporter.resources | indent 12 }} volumeMounts: - name: proc mountPath: /host/proc readOnly: true - name: sys mountPath: /host/sys readOnly: true {{- range .Values.prometheus.nodeExporter.extraHostPathMounts }} - name: {{ .name }} mountPath: {{ .mountPath }} readOnly: {{ .readOnly }} {{- if .mountPropagation }} mountPropagation: {{ .mountPropagation }} {{- end }} {{- end }} {{- range .Values.prometheus.nodeExporter.extraConfigmapMounts }} - name: {{ .name }} mountPath: {{ .mountPath }} readOnly: {{ .readOnly }} {{- end }} {{- if .Values.prometheus.imagePullSecrets }} imagePullSecrets: {{ toYaml .Values.prometheus.imagePullSecrets | indent 2 }} {{- end }} {{- if .Values.prometheus.nodeExporter.hostNetwork }} hostNetwork: true {{- end }} {{- if .Values.prometheus.nodeExporter.hostPID }} hostPID: true {{- end }} {{- if .Values.prometheus.nodeExporter.tolerations }} tolerations: {{ toYaml .Values.prometheus.nodeExporter.tolerations | indent 8 }} {{- end }} {{- if .Values.prometheus.nodeExporter.nodeSelector }} nodeSelector: {{ toYaml .Values.prometheus.nodeExporter.nodeSelector | indent 8 }} {{- end }} {{- if .Values.prometheus.nodeExporter.securityContext }} securityContext: {{ toYaml .Values.prometheus.nodeExporter.securityContext | indent 8 }} {{- end }} volumes: - name: proc hostPath: path: /proc - name: sys hostPath: path: /sys {{- range .Values.prometheus.nodeExporter.extraHostPathMounts }} - name: {{ .name }} hostPath: path: {{ .hostPath }} {{- end }} {{- range .Values.prometheus.nodeExporter.extraConfigmapMounts }} - name: {{ .name }} configMap: name: {{ .configMap }} {{- end }} {{- end -}} {{ end }}