daemonset.yaml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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. {{- if .Values.nodeExporter.hostRootfs }}
  49. - --path.rootfs=/host/root
  50. {{- end }}
  51. {{- if .Values.nodeExporter.hostNetwork }}
  52. - --web.listen-address=:{{ .Values.nodeExporter.service.hostPort }}
  53. {{- end }}
  54. {{- range $key, $value := .Values.nodeExporter.extraArgs }}
  55. {{- if $value }}
  56. - --{{ $key }}={{ $value }}
  57. {{- else }}
  58. - --{{ $key }}
  59. {{- end }}
  60. {{- end }}
  61. ports:
  62. - name: metrics
  63. {{- if .Values.nodeExporter.hostNetwork }}
  64. containerPort: {{ .Values.nodeExporter.service.hostPort }}
  65. {{- else }}
  66. containerPort: 9100
  67. {{- end }}
  68. hostPort: {{ .Values.nodeExporter.service.hostPort }}
  69. resources:
  70. {{ toYaml .Values.nodeExporter.resources | indent 12 }}
  71. volumeMounts:
  72. - name: proc
  73. mountPath: /host/proc
  74. readOnly: true
  75. - name: sys
  76. mountPath: /host/sys
  77. readOnly: true
  78. {{- if .Values.nodeExporter.hostRootfs }}
  79. - name: root
  80. mountPath: /host/root
  81. mountPropagation: HostToContainer
  82. readOnly: true
  83. {{- end }}
  84. {{- range .Values.nodeExporter.extraHostPathMounts }}
  85. - name: {{ .name }}
  86. mountPath: {{ .mountPath }}
  87. readOnly: {{ .readOnly }}
  88. {{- if .mountPropagation }}
  89. mountPropagation: {{ .mountPropagation }}
  90. {{- end }}
  91. {{- end }}
  92. {{- range .Values.nodeExporter.extraConfigmapMounts }}
  93. - name: {{ .name }}
  94. mountPath: {{ .mountPath }}
  95. readOnly: {{ .readOnly }}
  96. {{- end }}
  97. {{- if .Values.imagePullSecrets }}
  98. imagePullSecrets:
  99. {{ toYaml .Values.imagePullSecrets | indent 8 }}
  100. {{- end }}
  101. {{- if .Values.nodeExporter.hostNetwork }}
  102. hostNetwork: true
  103. {{- end }}
  104. {{- if .Values.nodeExporter.hostPID }}
  105. hostPID: true
  106. {{- end }}
  107. {{- if .Values.nodeExporter.tolerations }}
  108. tolerations:
  109. {{ toYaml .Values.nodeExporter.tolerations | indent 8 }}
  110. {{- end }}
  111. {{- if .Values.nodeExporter.nodeSelector }}
  112. nodeSelector:
  113. {{ toYaml .Values.nodeExporter.nodeSelector | indent 8 }}
  114. {{- end }}
  115. {{- with .Values.nodeExporter.dnsConfig }}
  116. dnsConfig:
  117. {{ toYaml . | indent 8 }}
  118. {{- end }}
  119. {{- if .Values.nodeExporter.securityContext }}
  120. securityContext:
  121. {{ toYaml .Values.nodeExporter.securityContext | indent 8 }}
  122. {{- end }}
  123. volumes:
  124. - name: proc
  125. hostPath:
  126. path: /proc
  127. - name: sys
  128. hostPath:
  129. path: /sys
  130. {{- if .Values.nodeExporter.hostRootfs }}
  131. - name: root
  132. hostPath:
  133. path: /
  134. {{- end }}
  135. {{- range .Values.nodeExporter.extraHostPathMounts }}
  136. - name: {{ .name }}
  137. hostPath:
  138. path: {{ .hostPath }}
  139. {{- end }}
  140. {{- range .Values.nodeExporter.extraConfigmapMounts }}
  141. - name: {{ .name }}
  142. configMap:
  143. name: {{ .configMap }}
  144. {{- end }}
  145. {{- end -}}