From c641f0f6ab3d5a933cb1aedd2c1f80b5bd563cc1 Mon Sep 17 00:00:00 2001 From: Sulochan Acharya Date: Thu, 22 Feb 2024 07:40:21 +0000 Subject: [PATCH] [prometheus-rabbitmq-exporter] Allows reading User from secret Currently the exporter allows using password from secret. This patch allows users to read username from secret as well. This is used in cases where automated username is created during install process of rabbitmq service. Signed-off-by: Sulochan Acharya --- charts/prometheus-rabbitmq-exporter/Chart.yaml | 2 +- .../templates/deployment.yaml | 9 +++++++-- charts/prometheus-rabbitmq-exporter/values.yaml | 3 +++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/charts/prometheus-rabbitmq-exporter/Chart.yaml b/charts/prometheus-rabbitmq-exporter/Chart.yaml index 0c01048e9abe..a07751509c2a 100644 --- a/charts/prometheus-rabbitmq-exporter/Chart.yaml +++ b/charts/prometheus-rabbitmq-exporter/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v1 description: Rabbitmq metrics exporter for prometheus name: prometheus-rabbitmq-exporter -version: 1.10.0 +version: 1.11.0 appVersion: v0.29.0 home: https://github.com/kbudde/rabbitmq_exporter sources: diff --git a/charts/prometheus-rabbitmq-exporter/templates/deployment.yaml b/charts/prometheus-rabbitmq-exporter/templates/deployment.yaml index 83aedf52df00..99c50e75662b 100644 --- a/charts/prometheus-rabbitmq-exporter/templates/deployment.yaml +++ b/charts/prometheus-rabbitmq-exporter/templates/deployment.yaml @@ -59,8 +59,13 @@ spec: - name: RABBIT_PASSWORD value: {{ .Values.rabbitmq.password }} {{- end }} - - {{- if .Values.rabbitmq.user }} + {{- if .Values.rabbitmq.existingUserSecret }} + - name: RABBIT_USER + valueFrom: + secretKeyRef: + name: "{{ .Values.rabbitmq.existingUserSecret }}" + key: "{{ .Values.rabbitmq.existingUserSecretKey }}" + {{- else if .Values.rabbitmq.user }} - name: RABBIT_USER value: {{ .Values.rabbitmq.user }} {{- end }} diff --git a/charts/prometheus-rabbitmq-exporter/values.yaml b/charts/prometheus-rabbitmq-exporter/values.yaml index 029e1e9b95e4..c28a0c303de3 100644 --- a/charts/prometheus-rabbitmq-exporter/values.yaml +++ b/charts/prometheus-rabbitmq-exporter/values.yaml @@ -39,6 +39,9 @@ rabbitmq: url: http://myrabbit:15672 user: guest password: guest + # If existingUserSecret is set then user is ignored + existingUserSecret: ~ + existingUserSecretKey: username # If existingPasswordSecret is set then password is ignored existingPasswordSecret: ~ existingPasswordSecretKey: password