From 9cbaf0bc2b0280ffd2b73f4b095aee128767969b Mon Sep 17 00:00:00 2001 From: Blake R <85771645+blakeromano@users.noreply.github.com> Date: Mon, 13 Nov 2023 11:33:58 -0700 Subject: [PATCH] Add Ability to Source Username from External Secret --- charts/pact-broker/templates/_helpers.tpl | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/charts/pact-broker/templates/_helpers.tpl b/charts/pact-broker/templates/_helpers.tpl index 6a45581..9a9b2d1 100644 --- a/charts/pact-broker/templates/_helpers.tpl +++ b/charts/pact-broker/templates/_helpers.tpl @@ -158,7 +158,16 @@ Database ENV Vars - name: PACT_BROKER_DATABASE_NAME value: {{ include "broker.databaseName" . }} - name: PACT_BROKER_DATABASE_USERNAME - value: {{ include "broker.databaseUser" . }} + {{- if .Values.postgresql.enabled }} + value: {{ .Values.postgresql.auth.password | quote }} + {{- else if and .Values.externalDatabase.enabled .Values.externalDatabase.config.auth.username }} + value: {{ .Values.externalDatabase.config.auth.username | quote }} + {{- else }} + valueFrom: + secretKeyRef: + name: {{ include "broker.databaseUserSecretName" . }} + key: {{ include "broker.databaseUserSecretKey" . }} + {{- end }} - name: PACT_BROKER_DATABASE_PASSWORD {{- if and .Values.postgresql.enabled .Values.postgresql.auth.password }} value: {{ .Values.postgresql.auth.password | quote }} @@ -210,4 +219,4 @@ Database Cleanup ENV Vars value: {{ .Values.broker.config.databaseClean.keepVersionSelectors | quote }} - name: PACT_BROKER_DATABASE_CLEAN_DRY_RUN value: {{ .Values.broker.config.databaseClean.dryRun | quote }} -{{- end -}} \ No newline at end of file +{{- end -}}