1
0
Fork 0

h-a: Add init container to wait for PostgreSQL

When Home Assistant starts, if PostgreSQL is unavailable, it will come
up successfully, but without the history component.  It never tries
again to connect and enable the component.  This makes it difficult to
detect the problem and thus easy to overlook the missing functionality.
To avoid having extended periods of missing state history, we'll force
Home Assistant to wait for PostgreSQL to come up before starting.
dch-webhooks-secrets
Dustin 2024-01-21 19:50:54 -06:00
parent 50beecf0a9
commit 832dea2c7d
1 changed files with 22 additions and 0 deletions

View File

@ -47,6 +47,28 @@ patches:
spec: spec:
template: template:
spec: spec:
initContainers:
- name: waitfordb
image: docker.io/library/postgres:15
command:
- sh
- -c
- until pg_isready; do sleep 1; done
env:
- name: PGHOST
value: default.postgresql
- name: PGGDATABASE
value: homeassistant
- name: PGUSER
valueFrom:
secretKeyRef:
name: home-assistant.homeassistant.default.credentials.postgresql.acid.zalan.do
key: username
- name: PGPASSWORD
valueFrom:
secretKeyRef:
name: home-assistant.homeassistant.default.credentials.postgresql.acid.zalan.do
key: password
containers: containers:
- name: home-assistant - name: home-assistant
env: env: