From d2db8d3f44733f405373c9dbaf1d6052802ad8c3 Mon Sep 17 00:00:00 2001
From: Janne Mareike Koschinski <janne@kuschku.de>
Date: Sun, 26 Mar 2023 16:47:51 +0200
Subject: [PATCH] fix: correct postgres naming

---
 postgresql/templates/secret.yaml      | 6 +++---
 postgresql/templates/statefulset.yaml | 4 ++--
 postgresql/values.yaml                | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/postgresql/templates/secret.yaml b/postgresql/templates/secret.yaml
index 8902daa..91454e5 100644
--- a/postgresql/templates/secret.yaml
+++ b/postgresql/templates/secret.yaml
@@ -9,13 +9,13 @@ metadata:
     {{- include "postgresql-helm.labels" . | nindent 4 }}
 type: Opaque
 data:
-  {{ if empty .Values.postgresqlPassword }}
+  {{ if empty .Values.postgresPassword }}
   # retrieve the secret data using lookup function and when not exists, return an empty dictionary / map as result
   {{- $secretObj := (lookup "v1" "Secret" .Release.Namespace $fullname) | default dict }}
   {{- $secretData := (get $secretObj "data") | default dict }}
   # set $secret to existing secret data or generate a random one when not exists
   {{- $secretValue := (get $secretData $fullname) | default (randAlphaNum 48 | b64enc) }}
-  postgresql-password: {{ $secretValue | quote }}
+  postgres-password: {{ $secretValue | quote }}
   {{ else }}
-  postgresql-password: "{{ .Values.postgresqlPassword }}"
+  postgres-password: "{{ .Values.postgresPassword }}"
   {{ end }}
\ No newline at end of file
diff --git a/postgresql/templates/statefulset.yaml b/postgresql/templates/statefulset.yaml
index 94afc71..4dca6e4 100644
--- a/postgresql/templates/statefulset.yaml
+++ b/postgresql/templates/statefulset.yaml
@@ -47,10 +47,10 @@ spec:
           image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
           imagePullPolicy: {{ .Values.image.pullPolicy }}
           env:
-            - name: postgresql_PASSWORD
+            - name: POSTGRES_PASSWORD
               valueFrom:
                 secretKeyRef:
-                  key: "postgresql-password"
+                  key: "postgres-password"
                   name: {{ include "postgresql-helm.fullname" . }}
           ports:
             - name: sql
diff --git a/postgresql/values.yaml b/postgresql/values.yaml
index 31a606d..712b129 100644
--- a/postgresql/values.yaml
+++ b/postgresql/values.yaml
@@ -13,7 +13,7 @@ volume: |-
   emptyDir: {}
 
 # if left empty, one will be auto-generated
-postgresqlPassword: ""
+postgresPassword: ""
 
 tls:
   enabled: false
-- 
GitLab