Skip to content

Commit

Permalink
[prometheus-rabbitmq-exporter] Allows reading User from secret
Browse files Browse the repository at this point in the history
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 committed Feb 22, 2024
1 parent 71bba71 commit f9bb4d9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
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 f9bb4d9

Please sign in to comment.