From 3dab0ea7e59cdd949b88c614a4c00ff06c9be3d8 Mon Sep 17 00:00:00 2001 From: AixesHunter <44970652+aixeshunter@users.noreply.github.com> Date: Mon, 23 Dec 2019 19:37:32 +0800 Subject: [PATCH] [stable/prometheus-redis-exporter]Add redis authoration configuration in chart (#19447) * Add redis authoration configuration in prometheus-redis-exporter chart Signed-off-by: aixeshunter * document all new values in the readme Signed-off-by: aixeshunter * Fix READ.md some bugs Signed-off-by: aixeshunter --- stable/prometheus-redis-exporter/Chart.yaml | 2 +- stable/prometheus-redis-exporter/README.md | 4 ++++ .../templates/deployment.yaml | 11 +++++++++++ stable/prometheus-redis-exporter/values.yaml | 10 ++++++++++ 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/stable/prometheus-redis-exporter/Chart.yaml b/stable/prometheus-redis-exporter/Chart.yaml index 7ba489a2f5..326ed0df95 100644 --- a/stable/prometheus-redis-exporter/Chart.yaml +++ b/stable/prometheus-redis-exporter/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v1 appVersion: 1.0.4 description: Prometheus exporter for Redis metrics name: prometheus-redis-exporter -version: 3.2.0 +version: 3.2.1 home: https://github.com/oliver006/redis_exporter sources: - https://github.com/oliver006/redis_exporter diff --git a/stable/prometheus-redis-exporter/README.md b/stable/prometheus-redis-exporter/README.md index 7c0fc120ab..f21457e096 100644 --- a/stable/prometheus-redis-exporter/README.md +++ b/stable/prometheus-redis-exporter/README.md @@ -69,6 +69,10 @@ The following table lists the configurable parameters and their default values. | `serviceMonitor.targetLabels` | Set of labels to transfer on the Kubernetes Service onto the target. | | | `script.configmap` | Let you run a custom lua script from a configmap. The corresponding environment variable `REDIS_EXPORTER_SCRIPT` will be set automatically || | `script.keyname` | Name of the key inside configmap which contains your script || +| `auth.enabled` | Specifies whether redis uses authentication | `false` | +| `auth.secret.name` | Name of existing redis secret (ignores redisPassword) || +| `auth.secret.key` | Name of key containing password to be retrieved from the existing secret || +| `auth.redisPassword` | Redis password (when not stored in a secret) || For more information please refer to the [redis_exporter](https://github.com/oliver006/redis_exporter) documentation. diff --git a/stable/prometheus-redis-exporter/templates/deployment.yaml b/stable/prometheus-redis-exporter/templates/deployment.yaml index 58f95a462d..855efc2985 100644 --- a/stable/prometheus-redis-exporter/templates/deployment.yaml +++ b/stable/prometheus-redis-exporter/templates/deployment.yaml @@ -42,6 +42,17 @@ spec: env: - name: REDIS_ADDR value: {{ .Values.redisAddress }} + {{- if .Values.auth.enabled }} + - name: REDIS_PASSWORD + {{- if .Values.auth.secret.name }} + valueFrom: + secretKeyRef: + name: {{ .Values.auth.secret.name }} + key: {{ .Values.secret.key }} + {{- else }} + value: {{ .Values.auth.redisPassword }} + {{- end }} + {{- end }} {{- if .Values.script }} - name: REDIS_EXPORTER_SCRIPT value: /script/script.lua diff --git a/stable/prometheus-redis-exporter/values.yaml b/stable/prometheus-redis-exporter/values.yaml index 439d8c5c38..aacdb14e7e 100644 --- a/stable/prometheus-redis-exporter/values.yaml +++ b/stable/prometheus-redis-exporter/values.yaml @@ -58,3 +58,13 @@ serviceMonitor: # script: # configmap: prometheus-redis-exporter-script # keyname: script + +auth: + # Use password authentication + enabled: false + # Use existing secret (ignores redisPassword) + secret: + name: "" + key: "" + # Redis password (when not stored in a secret) + redisPassword: ""