From 62c5049322cefb0f79022e46528770cc22fad7f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin=20Bj=C3=B6rklin?= Date: Mon, 9 Sep 2024 16:05:27 -0700 Subject: [PATCH] feat: allow extending smartctl drivedb via configmap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Robin Björklin --- .../templates/configmap.yaml | 11 +++++++++++ .../templates/daemonset.yaml | 10 ++++++++++ charts/prometheus-smartctl-exporter/values.yaml | 2 ++ 3 files changed, 23 insertions(+) create mode 100644 charts/prometheus-smartctl-exporter/templates/configmap.yaml diff --git a/charts/prometheus-smartctl-exporter/templates/configmap.yaml b/charts/prometheus-smartctl-exporter/templates/configmap.yaml new file mode 100644 index 000000000000..eb6188dc39c0 --- /dev/null +++ b/charts/prometheus-smartctl-exporter/templates/configmap.yaml @@ -0,0 +1,11 @@ +{{- if ne .Values.drivedb "" }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "prometheus-smartctl-exporter.fullname" . }}-drivedb + labels: + {{- include "prometheus-smartctl-exporter.labels" . | nindent 4 }} +data: + smart_drivedb.h: | + {{- .Values.drivedb | nindent 4 }} +{{- end }} diff --git a/charts/prometheus-smartctl-exporter/templates/daemonset.yaml b/charts/prometheus-smartctl-exporter/templates/daemonset.yaml index a40e78f4124c..dc4c1400cae5 100644 --- a/charts/prometheus-smartctl-exporter/templates/daemonset.yaml +++ b/charts/prometheus-smartctl-exporter/templates/daemonset.yaml @@ -59,6 +59,11 @@ spec: volumeMounts: - mountPath: /hostdev name: dev +{{- if ne $global.Values.drivedb "" }} + - name: config-volume + mountPath: /etc/smart_drivedb.h + subPath: smart_drivedb.h +{{- end }} dnsPolicy: ClusterFirst hostNetwork: true restartPolicy: Always @@ -67,6 +72,11 @@ spec: - hostPath: path: /dev name: dev +{{- if ne $global.Values.drivedb "" }} + - name: config-volume + configMap: + name: {{ template "prometheus-smartctl-exporter.fullname" $global }}-drivedb +{{- end }} {{- with $item.nodeSelector }} nodeSelector: {{ toYaml . | indent 8 }} diff --git a/charts/prometheus-smartctl-exporter/values.yaml b/charts/prometheus-smartctl-exporter/values.yaml index 001def18abf5..75e180be8a05 100644 --- a/charts/prometheus-smartctl-exporter/values.yaml +++ b/charts/prometheus-smartctl-exporter/values.yaml @@ -84,3 +84,5 @@ service: enabled: false ipFamilies: ["IPv6", "IPv4"] ipFamilyPolicy: "PreferDualStack" + +drivedb: ""