Commit ece00e0
committed
fix: wait for Postgres before starting backend
The CNPG Cluster takes ~25-30s to bootstrap initdb, but the backend
Deployment is applied at the same time as the Cluster. The new Backstage
backend attempts its database connection once at startup; on failure it
stays up in a degraded state (liveness 200, readiness 503) instead of
crash-looping, so Kubernetes never restarts it and the rollout never
completes. This failed the kind e2e and would equally strand the pod in
production, where Flux applies the Cluster and Deployment together.
Add a wait-for-postgres initContainer to the database-cnpg component so
the backend only starts once Postgres accepts connections. It reuses the
CNPG image (pg_isready, already cached on the nodes) and mirrors the
hardened container securityContext.1 parent 1fd6787 commit ece00e0
1 file changed
Lines changed: 29 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
8 | 37 | | |
9 | 38 | | |
10 | 39 | | |
| |||
0 commit comments