From e7a4bf118bc7f80125e6adac9fe6fd05df3a9093 Mon Sep 17 00:00:00 2001 From: David Constenla <1520001+daconstenla@users.noreply.github.com> Date: Tue, 26 Sep 2023 07:22:14 +0200 Subject: [PATCH] [prometheus-redis-exporter] Allow `REDIS_ADDR` environment variable to be configured through a secret (#3775) * Allow `REDIS_ADDR` env var to be configured through a secret additionally to the configmap Signed-off-by: David Constenla * Be explicit about the change breaking the values signature And adjust variable names Co-authored-by: zeritti <47476160+zeritti@users.noreply.github.com> Signed-off-by: David Constenla <1520001+daconstenla@users.noreply.github.com> * Update the comment so it represents the current configuration Signed-off-by: David Constenla --------- Signed-off-by: David Constenla Signed-off-by: David Constenla <1520001+daconstenla@users.noreply.github.com> Co-authored-by: zeritti <47476160+zeritti@users.noreply.github.com> --- charts/prometheus-redis-exporter/Chart.yaml | 2 +- .../prometheus-redis-exporter/templates/deployment.yaml | 8 ++++++-- charts/prometheus-redis-exporter/values.yaml | 8 +++++--- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/charts/prometheus-redis-exporter/Chart.yaml b/charts/prometheus-redis-exporter/Chart.yaml index 3119e1071740..969c24054b48 100644 --- a/charts/prometheus-redis-exporter/Chart.yaml +++ b/charts/prometheus-redis-exporter/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 appVersion: v1.54.0 description: Prometheus exporter for Redis metrics name: prometheus-redis-exporter -version: 5.6.0 +version: 6.0.0 home: https://github.com/oliver006/redis_exporter sources: - https://github.com/oliver006/redis_exporter diff --git a/charts/prometheus-redis-exporter/templates/deployment.yaml b/charts/prometheus-redis-exporter/templates/deployment.yaml index bbc31c698024..2e12783872d5 100644 --- a/charts/prometheus-redis-exporter/templates/deployment.yaml +++ b/charts/prometheus-redis-exporter/templates/deployment.yaml @@ -55,9 +55,13 @@ spec: - name: REDIS_ADDR {{- if .Values.redisAddressConfig.enabled }} valueFrom: + {{- if .Values.redisAddressConfig.isSecret }} + secretKeyRef: + {{- else }} configMapKeyRef: - name: {{ .Values.redisAddressConfig.configmap.name }} - key: {{ .Values.redisAddressConfig.configmap.key }} + {{- end }} + name: {{ .Values.redisAddressConfig.source.name }} + key: {{ .Values.redisAddressConfig.source.key }} {{- else }} value: {{ .Values.redisAddress }} {{- end }} diff --git a/charts/prometheus-redis-exporter/values.yaml b/charts/prometheus-redis-exporter/values.yaml index 305d076f1de9..d113dcc15ad9 100644 --- a/charts/prometheus-redis-exporter/values.yaml +++ b/charts/prometheus-redis-exporter/values.yaml @@ -61,10 +61,12 @@ labels: {} # prometheus.io/scrape: "true" redisAddressConfig: - # Use config from configmap + # configure `REDIS_ADDR` from a configmap enabled: false - # Use existing configmap (ignores redisAddress) - configmap: + # if `true` the `REDIS_ADDR` is sourced on a secret instead of a configmap + isSecret: false + # Use an existing configmap or secret will ignore redisAddress + source: name: "" key: ""