Connect from libpq service files and match the real Secret layout
The maintainer's login Secrets carry pg_service.conf ([evolution]), pgpass and ca.crt. Add a strict read_pg_service (known keys only, verify-full unless a local socket, bounded size) behind --pg-service in evo-server and evo-world-clone, mount each login Secret whole in the store Jobs instead of reading aevolution-db, and fix the migrate Job's PGSERVICE to the [evolution] section. Record the store node choice, per-environment databases and the backup plan. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -31,7 +31,7 @@ spec:
|
||||
requests: {cpu: 100m, memory: 64Mi}
|
||||
limits: {cpu: 500m, memory: 128Mi}
|
||||
env:
|
||||
- {name: PGSERVICE, value: evolution-migrator}
|
||||
- {name: PGSERVICE, value: evolution}
|
||||
- {name: PGSERVICEFILE, value: /run/postgres/pg_service.conf}
|
||||
- {name: EVO_PGPASS_SOURCE, value: /run/postgres/pgpass}
|
||||
# Operator-created NOLOGIN group role; the runtime login is its member.
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
# REPLACE_RUNTIME_ROLE that environment's NOLOGIN runtime group role
|
||||
# REPLACE_TOOLS_DIGEST aevolution-postgres-tools image digest (sha256:...)
|
||||
# REPLACE_SERVER_DIGEST aevolution server-runtime image digest (sha256:...)
|
||||
# Secret contract (docs/infrastructure/ENVIRONMENTS.md, never in Git):
|
||||
# aevolution-db: PGHOST, PGHOSTADDR, PGPORT, PGDATABASE (only these
|
||||
# keys are read; PGPASSWORD/PGUSER are never mounted)
|
||||
# evolution-postgres-migrator: pg_service.conf, pgpass, ca.crt (migrate-postgres.sh)
|
||||
# evolution-postgres-runtime: user, pgpass, ca.crt
|
||||
# Secret contract (docs/infrastructure/ENVIRONMENTS.md, never in Git). Each login
|
||||
# Secret is self-contained, with keys pg_service.conf (section [evolution], with
|
||||
# sslrootcert=/run/postgres/ca.crt), pgpass and ca.crt:
|
||||
# evolution-postgres-migrator the environment's migrator login (migrate-postgres.sh)
|
||||
# evolution-postgres-runtime the environment's runtime login (check-store, region)
|
||||
# Order: apply the NetworkPolicy, run migrate, then check-store (twice: the second
|
||||
# run must report "probe verified", proving the volume survived a new pod).
|
||||
apiVersion: networking.k8s.io/v1
|
||||
@@ -66,7 +66,7 @@ spec:
|
||||
- name: migrate
|
||||
image: registry.aeternalisgames.com/aeternalis/aevolution-postgres-tools@REPLACE_TOOLS_DIGEST
|
||||
env:
|
||||
- {name: PGSERVICE, value: evolution-migrator}
|
||||
- {name: PGSERVICE, value: evolution}
|
||||
- {name: PGSERVICEFILE, value: /run/postgres/pg_service.conf}
|
||||
- {name: EVO_PGPASS_SOURCE, value: /run/postgres/pgpass}
|
||||
- {name: EVO_PG_RUNTIME_ROLE, value: REPLACE_RUNTIME_ROLE}
|
||||
@@ -134,20 +134,8 @@ spec:
|
||||
umask 077
|
||||
cp /run/postgres/pgpass /tmp/pgpass
|
||||
exec /usr/local/bin/evo-world-clone check-store --world 1 --region 1 \
|
||||
--objects /objects --pg-host "$DB_HOST" --pg-hostaddr "$DB_HOSTADDR" \
|
||||
--pg-port "$DB_PORT" --pg-database "$DB_NAME" --pg-user "$DB_USER" \
|
||||
--pg-passfile /tmp/pgpass --pg-ca /run/postgres/ca.crt
|
||||
env:
|
||||
- name: DB_HOST
|
||||
valueFrom: {secretKeyRef: {name: aevolution-db, key: PGHOST}}
|
||||
- name: DB_HOSTADDR
|
||||
valueFrom: {secretKeyRef: {name: aevolution-db, key: PGHOSTADDR}}
|
||||
- name: DB_PORT
|
||||
valueFrom: {secretKeyRef: {name: aevolution-db, key: PGPORT}}
|
||||
- name: DB_NAME
|
||||
valueFrom: {secretKeyRef: {name: aevolution-db, key: PGDATABASE}}
|
||||
- name: DB_USER
|
||||
valueFrom: {secretKeyRef: {name: evolution-postgres-runtime, key: user}}
|
||||
--objects /objects --pg-service /run/postgres/pg_service.conf \
|
||||
--pg-passfile /tmp/pgpass
|
||||
resources:
|
||||
requests: {cpu: 50m, memory: 64Mi}
|
||||
limits: {memory: 256Mi}
|
||||
@@ -170,5 +158,6 @@ spec:
|
||||
secretName: evolution-postgres-runtime
|
||||
defaultMode: 0440
|
||||
items:
|
||||
- {key: pg_service.conf, path: pg_service.conf}
|
||||
- {key: pgpass, path: pgpass}
|
||||
- {key: ca.crt, path: ca.crt}
|
||||
|
||||
Reference in New Issue
Block a user