Skip to content

Commit

Permalink
feat: Create secret to store credentials when provided (#5099)
Browse files Browse the repository at this point in the history
Signed-off-by: Julio Chana <julio.chana@lokalise.com>
  • Loading branch information
jchanam authored Dec 28, 2024
1 parent a1ef252 commit 4dac64a
Show file tree
Hide file tree
Showing 3 changed files with 31 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.12.1
version: 1.13.0
appVersion: v0.29.0
home: https://github.com/kbudde/rabbitmq_exporter
sources:
Expand Down
10 changes: 8 additions & 2 deletions charts/prometheus-rabbitmq-exporter/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ spec:
key: "{{ .Values.rabbitmq.existingPasswordSecretKey }}"
{{- else if .Values.rabbitmq.password }}
- name: RABBIT_PASSWORD
value: {{ .Values.rabbitmq.password }}
valueFrom:
secretKeyRef:
name: {{ template "prometheus-rabbitmq-exporter.fullname" . }}
key: RABBIT_PASSWORD
{{- end }}
{{- if .Values.rabbitmq.existingUserSecret }}
- name: RABBIT_USER
Expand All @@ -67,7 +70,10 @@ spec:
key: "{{ .Values.rabbitmq.existingUserSecretKey }}"
{{- else if .Values.rabbitmq.user }}
- name: RABBIT_USER
value: {{ .Values.rabbitmq.user }}
valueFrom:
secretKeyRef:
name: {{ template "prometheus-rabbitmq-exporter.fullname" . }}
key: RABBIT_USER
{{- end }}
{{- if .Values.rabbitmq.url }}
- name: RABBIT_URL
Expand Down
22 changes: 22 additions & 0 deletions charts/prometheus-rabbitmq-exporter/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{{- if or (and (.Values.rabbitmq.password) (not .Values.rabbitmq.existingPasswordSecret)) (and (.Values.rabbitmq.user) (not .Values.rabbitmq.existingUserSecret)) }}
apiVersion: v1
kind: Secret
metadata:
name: {{ template "prometheus-rabbitmq-exporter.fullname" . }}
labels:
app: {{ template "prometheus-rabbitmq-exporter.name" . }}
chart: {{ template "prometheus-rabbitmq-exporter.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- if .Values.additionalLabels }}
{{ toYaml .Values.additionalLabels | indent 4 }}
{{- end }}
type: Opaque
data:
{{- if and (.Values.rabbitmq.password) (not .Values.rabbitmq.existingPasswordSecret) }}
RABBIT_PASSWORD: {{ .Values.rabbitmq.password | b64enc }}
{{- end }}
{{- if and (.Values.rabbitmq.user) (not .Values.rabbitmq.existingUserSecret) }}
RABBIT_USER: {{ .Values.rabbitmq.user | b64enc }}
{{- end }}
{{- end }}

0 comments on commit 4dac64a

Please sign in to comment.