daemonset.yaml 4.4 KB

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