From a7b72aa0f5f3630750c76c5fc0b83ca8bcfdcd26 Mon Sep 17 00:00:00 2001 From: Juan Ariza Toledano Date: Mon, 27 Nov 2023 16:27:28 +0100 Subject: [PATCH] [bitnami/postgresql] Fix PostgreSQL password in metrics container (#21202) --- bitnami/postgresql/Chart.yaml | 2 +- bitnami/postgresql/templates/primary/statefulset.yaml | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/bitnami/postgresql/Chart.yaml b/bitnami/postgresql/Chart.yaml index 505bd00d49..8320353677 100644 --- a/bitnami/postgresql/Chart.yaml +++ b/bitnami/postgresql/Chart.yaml @@ -35,4 +35,4 @@ maintainers: name: postgresql sources: - https://github.com/bitnami/charts/tree/main/bitnami/postgresql -version: 13.2.18 +version: 13.2.19 diff --git a/bitnami/postgresql/templates/primary/statefulset.yaml b/bitnami/postgresql/templates/primary/statefulset.yaml index 9735ed5ec1..cb9374d6b7 100644 --- a/bitnami/postgresql/templates/primary/statefulset.yaml +++ b/bitnami/postgresql/templates/primary/statefulset.yaml @@ -509,15 +509,16 @@ spec: {{- $database := required "In order to enable metrics you need to specify a database (.Values.auth.database or .Values.global.postgresql.auth.database)" (include "postgresql.v1.database" .) }} - name: DATA_SOURCE_URI value: {{ printf "127.0.0.1:%d/%s?sslmode=disable" (int (include "postgresql.v1.service.port" .)) $database }} + {{- $pwdKey := ternary (include "postgresql.v1.adminPasswordKey" .) (include "postgresql.v1.userPasswordKey" .) (or (eq $customUser "postgres") (empty $customUser)) }} {{- if .Values.auth.usePasswordFiles }} - name: DATA_SOURCE_PASS_FILE - value: {{ printf "/opt/bitnami/postgresql/secrets/%s" (include "postgresql.v1.userPasswordKey" .) }} + value: {{ printf "/opt/bitnami/postgresql/secrets/%s" $pwdKey }} {{- else }} - name: DATA_SOURCE_PASS valueFrom: secretKeyRef: name: {{ include "postgresql.v1.secretName" . }} - key: {{ include "postgresql.v1.userPasswordKey" . }} + key: {{ $pwdKey }} {{- end }} - name: DATA_SOURCE_USER value: {{ default "postgres" $customUser | quote }}