Configure the secret so we can connect

Signed-off-by: Martyn Ranyard <m@rtyn.berlin>
This commit is contained in:
Martyn 2023-11-15 15:11:41 +01:00
parent 30c38f06c1
commit 6bc6703659
1 changed files with 27 additions and 0 deletions

View File

@ -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