Add support for prometheus
[ric-plt/ric-dep.git] / helm / infrastructure / subcharts / prometheus / templates / node-exporter-daemonset.yaml
1 {{- if .Values.nodeExporter.enabled -}}
2 apiVersion: {{ template "prometheus.daemonset.apiVersion" . }}
3 kind: DaemonSet
4 metadata:
5 {{- if .Values.nodeExporter.deploymentAnnotations }}
6   annotations:
7 {{ toYaml .Values.nodeExporter.deploymentAnnotations | indent 4 }}
8 {{- end }}
9   labels:
10     {{- include "prometheus.nodeExporter.labels" . | nindent 4 }}
11   name: {{ template "prometheus.nodeExporter.fullname" . }}
12 {{ include "prometheus.namespace" . | indent 2 }}
13 spec:
14   selector:
15     matchLabels:
16       {{- include "prometheus.nodeExporter.matchLabels" . | nindent 6 }}
17   {{- if .Values.nodeExporter.updateStrategy }}
18   updateStrategy:
19 {{ toYaml .Values.nodeExporter.updateStrategy | indent 4 }}
20   {{- end }}
21   template:
22     metadata:
23     {{- if .Values.nodeExporter.podAnnotations }}
24       annotations:
25 {{ toYaml .Values.nodeExporter.podAnnotations | indent 8 }}
26     {{- end }}
27       labels:
28         {{- include "prometheus.nodeExporter.labels" . | nindent 8 }}
29 {{- if .Values.nodeExporter.pod.labels }}
30 {{ toYaml .Values.nodeExporter.pod.labels | indent 8 }}
31 {{- end }}
32     spec:
33       serviceAccountName: {{ template "prometheus.serviceAccountName.nodeExporter" . }}
34       {{- if .Values.nodeExporter.extraInitContainers }}
35       initContainers:
36 {{ toYaml .Values.nodeExporter.extraInitContainers | indent 8 }}
37       {{- end }}
38 {{- if .Values.nodeExporter.priorityClassName }}
39       priorityClassName: "{{ .Values.nodeExporter.priorityClassName }}"
40 {{- end }}
41       containers:
42         - name: {{ template "prometheus.name" . }}-{{ .Values.nodeExporter.name }}
43           image: "{{ .Values.nodeExporter.image.repository }}:{{ .Values.nodeExporter.image.tag }}"
44           imagePullPolicy: "{{ .Values.nodeExporter.image.pullPolicy }}"
45           args:
46             - --path.procfs=/host/proc
47             - --path.sysfs=/host/sys
48           {{- range $key, $value := .Values.nodeExporter.extraArgs }}
49           {{- if $value }}
50             - --{{ $key }}={{ $value }}
51           {{- else }}
52             - --{{ $key }}
53           {{- end }}
54           {{- end }}
55           ports:
56             - name: metrics
57               containerPort: 9100
58               hostPort: {{ .Values.nodeExporter.service.hostPort }}
59           resources:
60 {{ toYaml .Values.nodeExporter.resources | indent 12 }}
61           volumeMounts:
62             - name: proc
63               mountPath: /host/proc
64               readOnly:  true
65             - name: sys
66               mountPath: /host/sys
67               readOnly: true
68           {{- range .Values.nodeExporter.extraHostPathMounts }}
69             - name: {{ .name }}
70               mountPath: {{ .mountPath }}
71               readOnly: {{ .readOnly }}
72             {{- if .mountPropagation }}
73               mountPropagation: {{ .mountPropagation }}
74             {{- end }}
75           {{- end }}
76           {{- range .Values.nodeExporter.extraConfigmapMounts }}
77             - name: {{ .name }}
78               mountPath: {{ .mountPath }}
79               readOnly: {{ .readOnly }}
80           {{- end }}
81     {{- if .Values.imagePullSecrets }}
82       imagePullSecrets:
83       {{ toYaml .Values.imagePullSecrets | indent 2 }}
84     {{- end }}
85     {{- if .Values.nodeExporter.hostNetwork }}
86       hostNetwork: true
87     {{- end }}
88     {{- if .Values.nodeExporter.hostPID }}
89       hostPID: true
90     {{- end }}
91     {{- if .Values.nodeExporter.tolerations }}
92       tolerations:
93 {{ toYaml .Values.nodeExporter.tolerations | indent 8 }}
94     {{- end }}
95     {{- if .Values.nodeExporter.nodeSelector }}
96       nodeSelector:
97 {{ toYaml .Values.nodeExporter.nodeSelector | indent 8 }}
98     {{- end }}
99     {{- if .Values.nodeExporter.securityContext }}
100       securityContext:
101 {{ toYaml .Values.nodeExporter.securityContext | indent 8 }}
102     {{- end }}
103       volumes:
104         - name: proc
105           hostPath:
106             path: /proc
107         - name: sys
108           hostPath:
109             path: /sys
110       {{- range .Values.nodeExporter.extraHostPathMounts }}
111         - name: {{ .name }}
112           hostPath:
113             path: {{ .hostPath }}
114       {{- end }}
115       {{- range .Values.nodeExporter.extraConfigmapMounts }}
116         - name: {{ .name }}
117           configMap:
118             name: {{ .configMap }}
119       {{- end }}
120
121 {{- end -}}