From 6bc670365924b0cb3cc9e91a113109e60e4ba581 Mon Sep 17 00:00:00 2001 From: Martyn Ranyard Date: Wed, 15 Nov 2023 15:11:41 +0100 Subject: [PATCH] Configure the secret so we can connect Signed-off-by: Martyn Ranyard --- apps-kustomized/home-assistant/deploy.yaml | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/apps-kustomized/home-assistant/deploy.yaml b/apps-kustomized/home-assistant/deploy.yaml index e9ef031..92454a1 100644 --- a/apps-kustomized/home-assistant/deploy.yaml +++ b/apps-kustomized/home-assistant/deploy.yaml @@ -56,6 +56,33 @@ spec: name: config dnsPolicy: ClusterFirst enableServiceLinks: true + initContainers: + - command: + - /bin/sh + - -c + - | + PG_HOST=homeassistant-postgres + PG_DB=homeassistant + echo "psql_string: \"postgresql://${PG_USER}:${PG_PASS}@${PG_HOST}/${PG_DB}\"" > /config/secrets.yaml + env: + - name: PG_USER + valueFrom: + secretKeyRef: + key: username + name: homeassistant.homeassistant-postgres.credentials.postgresql.acid.zalan.do + - name: PG_PASS + valueFrom: + secretKeyRef: + key: password + name: homeassistant.homeassistant-postgres.credentials.postgresql.acid.zalan.do + image: alpine:latest + imagePullPolicy: Always + name: dbsecret + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /config + name: config restartPolicy: Always schedulerName: default-scheduler serviceAccount: default