Skip to content

Commit

Permalink
[prometheus-rabbitmq-exporter] Allows reading User from secret (prome…
Browse files Browse the repository at this point in the history
…theus-community#4278)

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 <[email protected]>
  • Loading branch information
sulochan authored and Matiasmct committed Mar 20, 2024
1 parent 60edfdd commit 9bcc3d9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion charts/prometheus-rabbitmq-exporter/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
9 changes: 7 additions & 2 deletions charts/prometheus-rabbitmq-exporter/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
3 changes: 3 additions & 0 deletions charts/prometheus-rabbitmq-exporter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9bcc3d9

Please sign in to comment.