From b499a46e9885144e285bb1fb7396de7080bafdd6 Mon Sep 17 00:00:00 2001 From: Thomas Decaux Date: Wed, 24 Jan 2024 10:02:39 -0500 Subject: [PATCH 1/7] [node-exporter] Fix sidecars containers volumeMounts merge Signed-off-by: Thomas Decaux --- .../templates/_helpers.tpl | 19 +++++++++++++ .../templates/daemonset.yaml | 28 +++++++------------ charts/prometheus-node-exporter/values.yaml | 9 ++++-- 3 files changed, 36 insertions(+), 20 deletions(-) diff --git a/charts/prometheus-node-exporter/templates/_helpers.tpl b/charts/prometheus-node-exporter/templates/_helpers.tpl index 84552fe475a9..3aa3ebc3dace 100644 --- a/charts/prometheus-node-exporter/templates/_helpers.tpl +++ b/charts/prometheus-node-exporter/templates/_helpers.tpl @@ -183,3 +183,22 @@ labelNameLengthLimit: {{ . }} labelValueLengthLimit: {{ . }} {{- end }} {{- end }} + + + +{{/* Sets sidecar volumeMounts */}} +{{- define "prometheus-node-exporter.sidecarVolumeMounts" -}} +{{- range $_, $mount := $.Values.sidecarVolumeMount }} +- name: {{ $mount.name }} + mountPath: {{ $mount.mountPath }} + readOnly: {{ $mount.readOnly }} +{{- end }} +{{- range $_, $mount := $.Values.sidecarHostVolumeMounts }} +- name: {{ $mount.name }} + mountPath: {{ $mount.mountPath }} + readOnly: {{ $mount.readOnly }} +{{- if $mount.mountPropagation }} + mountPropagation: {{ $mount.mountPropagation }} +{{- end }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/prometheus-node-exporter/templates/daemonset.yaml b/charts/prometheus-node-exporter/templates/daemonset.yaml index d9e418169b25..85af11d11792 100644 --- a/charts/prometheus-node-exporter/templates/daemonset.yaml +++ b/charts/prometheus-node-exporter/templates/daemonset.yaml @@ -160,24 +160,16 @@ spec: - name: {{ .name }} mountPath: {{ .mountPath }} {{- end }} - {{- with .Values.sidecars }} - {{- toYaml . | nindent 8 }} - {{- if or $.Values.sidecarVolumeMount $.Values.sidecarHostVolumeMounts }} - volumeMounts: - {{- range $_, $mount := $.Values.sidecarVolumeMount }} - - name: {{ $mount.name }} - mountPath: {{ $mount.mountPath }} - readOnly: {{ $mount.readOnly }} - {{- end }} - {{- range $_, $mount := $.Values.sidecarHostVolumeMounts }} - - name: {{ $mount.name }} - mountPath: {{ $mount.mountPath }} - readOnly: {{ $mount.readOnly }} - {{- if $mount.mountPropagation }} - mountPropagation: {{ $mount.mountPropagation }} - {{- end }} - {{- end }} - {{- end }} + {{- range .Values.sidecars }} + {{- $overwrites := dict + "volumeMounts" (concat (include "prometheus-node-exporter.sidecarVolumeMounts" $ | fromYamlArray ) (.volumeMounts | default list) | default list) + }} + {{- $defaults := dict + "image" (include "prometheus-node-exporter.image" $) + "securityContext" $.Values.containerSecurityContext + "imagePullPolicy" $.Values.image.pullPolicy + }} + - {{- toYaml (merge $overwrites . $defaults ) | nindent 10 }} {{- end }} {{- if .Values.kubeRBACProxy.enabled }} - name: kube-rbac-proxy diff --git a/charts/prometheus-node-exporter/values.yaml b/charts/prometheus-node-exporter/values.yaml index 7cb89068cce3..46d9e58a4237 100644 --- a/charts/prometheus-node-exporter/values.yaml +++ b/charts/prometheus-node-exporter/values.yaml @@ -391,8 +391,13 @@ namespaceOverride: "" ## Additional containers for export metrics to text file ## sidecars: [] -## - name: nvidia-dcgm-exporter -## image: nvidia/dcgm-exporter:1.4.3 +# - name: nvidia-dcgm-exporter +# image: nvidia/dcgm-exporter:1.4.3 +# volumeMounts: +# - name: tmp +# mountPath: /tmp +# - name: nvidia-dcgm-exporter2 +# image: nvidia/dcgm-exporter:1.4.3 ## Volume for sidecar containers ## From f93243394f659bdb57c62cfdd3d10c77a3f308f9 Mon Sep 17 00:00:00 2001 From: Thomas Decaux Date: Wed, 24 Jan 2024 10:03:01 -0500 Subject: [PATCH 2/7] bump chart version Signed-off-by: Thomas Decaux --- charts/prometheus-node-exporter/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/prometheus-node-exporter/Chart.yaml b/charts/prometheus-node-exporter/Chart.yaml index 54feef684a61..83d592222528 100644 --- a/charts/prometheus-node-exporter/Chart.yaml +++ b/charts/prometheus-node-exporter/Chart.yaml @@ -6,7 +6,7 @@ keywords: - prometheus - exporter type: application -version: 4.25.0 +version: 4.26.0 appVersion: 1.7.0 home: https://github.com/prometheus/node_exporter/ sources: From 5aa9f04685c32610760f352c5b02c2512f7c2ca3 Mon Sep 17 00:00:00 2001 From: Thomas Decaux Date: Wed, 24 Jan 2024 10:55:46 -0500 Subject: [PATCH 3/7] bump chart version Signed-off-by: Thomas Decaux --- charts/prometheus-node-exporter/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/prometheus-node-exporter/Chart.yaml b/charts/prometheus-node-exporter/Chart.yaml index 83d592222528..923276db45fe 100644 --- a/charts/prometheus-node-exporter/Chart.yaml +++ b/charts/prometheus-node-exporter/Chart.yaml @@ -6,7 +6,7 @@ keywords: - prometheus - exporter type: application -version: 4.26.0 +version: 4.27.0 appVersion: 1.7.0 home: https://github.com/prometheus/node_exporter/ sources: From ea25a46ff28786975e9017c786287ba1ac2fb36c Mon Sep 17 00:00:00 2001 From: Thomas Decaux Date: Fri, 26 Jan 2024 07:56:42 -0500 Subject: [PATCH 4/7] Patch version Co-authored-by: MH Signed-off-by: Thomas Decaux --- charts/prometheus-node-exporter/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/prometheus-node-exporter/Chart.yaml b/charts/prometheus-node-exporter/Chart.yaml index 923276db45fe..aea1b521c30f 100644 --- a/charts/prometheus-node-exporter/Chart.yaml +++ b/charts/prometheus-node-exporter/Chart.yaml @@ -6,7 +6,7 @@ keywords: - prometheus - exporter type: application -version: 4.27.0 +version: 4.26.1 appVersion: 1.7.0 home: https://github.com/prometheus/node_exporter/ sources: From 7265548c0edc94baf837f94fe839c2c7a781fbbb Mon Sep 17 00:00:00 2001 From: Thomas Decaux Date: Sun, 28 Jan 2024 18:25:43 -0500 Subject: [PATCH 5/7] Update charts/prometheus-node-exporter/templates/daemonset.yaml Co-authored-by: zeritti <47476160+zeritti@users.noreply.github.com> Signed-off-by: Thomas Decaux --- charts/prometheus-node-exporter/templates/daemonset.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/prometheus-node-exporter/templates/daemonset.yaml b/charts/prometheus-node-exporter/templates/daemonset.yaml index 9140b5d1c1d4..1deae61e4156 100644 --- a/charts/prometheus-node-exporter/templates/daemonset.yaml +++ b/charts/prometheus-node-exporter/templates/daemonset.yaml @@ -162,7 +162,7 @@ spec: {{- end }} {{- range .Values.sidecars }} {{- $overwrites := dict - "volumeMounts" (concat (include "prometheus-node-exporter.sidecarVolumeMounts" $ | fromYamlArray ) (.volumeMounts | default list) | default list) + "volumeMounts" (concat (include "prometheus-node-exporter.sidecarVolumeMounts" $ | fromYamlArray) (.volumeMounts | default list) | default list) }} {{- $defaults := dict "image" (include "prometheus-node-exporter.image" $) From e61e2be709c473d8f77447989076ffe5e8c58087 Mon Sep 17 00:00:00 2001 From: Thomas Decaux Date: Sun, 28 Jan 2024 18:25:48 -0500 Subject: [PATCH 6/7] Update charts/prometheus-node-exporter/templates/daemonset.yaml Co-authored-by: zeritti <47476160+zeritti@users.noreply.github.com> Signed-off-by: Thomas Decaux --- charts/prometheus-node-exporter/templates/daemonset.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/prometheus-node-exporter/templates/daemonset.yaml b/charts/prometheus-node-exporter/templates/daemonset.yaml index 1deae61e4156..bcba856f916e 100644 --- a/charts/prometheus-node-exporter/templates/daemonset.yaml +++ b/charts/prometheus-node-exporter/templates/daemonset.yaml @@ -169,7 +169,7 @@ spec: "securityContext" $.Values.containerSecurityContext "imagePullPolicy" $.Values.image.pullPolicy }} - - {{- toYaml (merge $overwrites . $defaults ) | nindent 10 }} + - {{- toYaml (merge $overwrites . $defaults) | nindent 10 }} {{- end }} {{- if .Values.kubeRBACProxy.enabled }} - name: kube-rbac-proxy From 61299bd6869c934d2526844e43d4c7e63e3f5697 Mon Sep 17 00:00:00 2001 From: Thomas Decaux Date: Sun, 28 Jan 2024 18:31:25 -0500 Subject: [PATCH 7/7] fix lint Signed-off-by: Thomas Decaux --- charts/prometheus-node-exporter/templates/_helpers.tpl | 4 +--- charts/prometheus-node-exporter/values.yaml | 10 ++++------ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/charts/prometheus-node-exporter/templates/_helpers.tpl b/charts/prometheus-node-exporter/templates/_helpers.tpl index 3aa3ebc3dace..8e84832cbf7f 100644 --- a/charts/prometheus-node-exporter/templates/_helpers.tpl +++ b/charts/prometheus-node-exporter/templates/_helpers.tpl @@ -184,8 +184,6 @@ labelValueLengthLimit: {{ . }} {{- end }} {{- end }} - - {{/* Sets sidecar volumeMounts */}} {{- define "prometheus-node-exporter.sidecarVolumeMounts" -}} {{- range $_, $mount := $.Values.sidecarVolumeMount }} @@ -201,4 +199,4 @@ labelValueLengthLimit: {{ . }} mountPropagation: {{ $mount.mountPropagation }} {{- end }} {{- end }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/charts/prometheus-node-exporter/values.yaml b/charts/prometheus-node-exporter/values.yaml index 0313efe00e1d..8f3a038307f1 100644 --- a/charts/prometheus-node-exporter/values.yaml +++ b/charts/prometheus-node-exporter/values.yaml @@ -395,7 +395,7 @@ secrets: [] ## namespaceOverride: "" -## Additional containers for export metrics to text file +## Additional containers for export metrics to text file; fields image,imagePullPolicy,securityContext take default value from main container ## sidecars: [] # - name: nvidia-dcgm-exporter @@ -403,15 +403,13 @@ sidecars: [] # volumeMounts: # - name: tmp # mountPath: /tmp -# - name: nvidia-dcgm-exporter2 -# image: nvidia/dcgm-exporter:1.4.3 ## Volume for sidecar containers ## sidecarVolumeMount: [] -## - name: collector-textfiles -## mountPath: /run/prometheus -## readOnly: false +# - name: collector-textfiles +# mountPath: /run/prometheus +# readOnly: false ## Additional mounts from the host to sidecar containers ##