From 052d6fad6f6efd2c9452c561b63711fd2c35a8cf Mon Sep 17 00:00:00 2001
From: Thomas Menard <tmenard@pastreur.fr>
Date: Thu, 11 Apr 2024 16:47:19 +0200
Subject: [PATCH]

---
 chart/templates/deployment-celery-worker.yaml | 2 +-
 chart/templates/deployment-django.yaml        | 2 +-
 chart/templates/deployment-postgres.yaml      | 4 ++++
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/chart/templates/deployment-celery-worker.yaml b/chart/templates/deployment-celery-worker.yaml
index f4d444bc..8c5c8dec 100644
--- a/chart/templates/deployment-celery-worker.yaml
+++ b/chart/templates/deployment-celery-worker.yaml
@@ -62,7 +62,7 @@ spec:
           - name: POSTGRES_PASSWORD
             valueFrom:
               secretKeyRef:
-                name: {{ printf "postgres.%s-postgresql.credentials.postgresql.acid.zalan.do" .Release.Name }}
+                name: {{ printf "%s.%s-postgresql.credentials.postgresql.acid.zalan.do" .Values.dbUser .Release.Name }}
                 key: password
           {{end}}
           - name: POSTGRES_USER
diff --git a/chart/templates/deployment-django.yaml b/chart/templates/deployment-django.yaml
index aa3d3588..e6ad0980 100644
--- a/chart/templates/deployment-django.yaml
+++ b/chart/templates/deployment-django.yaml
@@ -61,7 +61,7 @@ spec:
           - name: POSTGRES_PASSWORD
             valueFrom:
               secretKeyRef:
-                name: {{ printf "postgres.%s-postgresql.credentials.postgresql.acid.zalan.do" .Release.Name }}
+                name: {{ printf "%s.%s-postgresql.credentials.postgresql.acid.zalan.do" .Values.dbUser .Release.Name }}
                 key: password
           {{end}}
           - name: POSTGRES_USER
diff --git a/chart/templates/deployment-postgres.yaml b/chart/templates/deployment-postgres.yaml
index c0e191b4..bafbd4ad 100644
--- a/chart/templates/deployment-postgres.yaml
+++ b/chart/templates/deployment-postgres.yaml
@@ -67,6 +67,10 @@ spec:
     synchronous_mode: false
     synchronous_mode_strict: false
     maximum_lag_on_failover: 33554432
+    pg_hba:
+    - hostssl all all 0.0.0.0/0 md5
+    - host    all all 0.0.0.0/0 md5
+    - local   all all           trust
 
   # restore a Postgres DB with point-in-time-recovery
   # with a non-empty timestamp, clone from an S3 bucket using the latest backup before the timestamp
-- 
GitLab