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:
dingo
2026-09-29 14:12:26 -04:00
co-authored by Claude Opus 5.5
parent 2d950060db
commit 8d594f28af
12 changed files with 221 additions and 31 deletions
+22 -6
View File
@@ -18,15 +18,30 @@ manual, and none is performed by Argo CD.
## Secret references (created by an operator, never committed)
Each environment has its own **database**: dev uses `aevolution` on the PostgreSQL
VM `pg-forge-01`. Stage needs a separate database, with its own migrator login and
runtime group. Sharing one database would let one environment's runtime login act
on the other's regions, because the fenced functions are per database, not per
environment.
Each namespace gets its own Secrets, with environment-specific values:
- `harbor-pull`: a pull-only Harbor robot (docker-registry type).
- `evolution-postgres-migrator`: the migrator/owner login for that environment's
database. Keys: `pg_service.conf`, `pgpass`, `ca.crt`.
database.
- `evolution-postgres-runtime`: the runtime login, a member of that environment's
NOLOGIN runtime group (ADR-0060). Keys: `user`, `pgpass`, `ca.crt`.
- `aevolution-db`: connection settings. Only `PGHOST`, `PGHOSTADDR` (numeric),
`PGPORT` and `PGDATABASE` are ever read, as individual variables. `PGPASSWORD`
and `PGUSER` are never mounted; the policy check forbids it.
NOLOGIN runtime group (ADR-0060).
Both login Secrets have the keys `pg_service.conf`, `pgpass` and `ca.crt`:
- `pg_service.conf` has an `[evolution]` section with `host`, a numeric
`hostaddr`, `port`, `dbname`, `user`, `sslmode=verify-full` and
`sslrootcert=/run/postgres/ca.crt`. `connect_timeout` is allowed. `evo-server`
and `evo-world-clone` read it with `--pg-service` and refuse any other key.
- `pgpass` is mounted, then copied to private memory before use, because libpq
ignores group-readable password files.
`aevolution-db` (the `PG*`/`POSTGRES_*` connection variables) is not used by
AEvolution workloads. `PGPASSWORD` and `PGUSER` are never placed in a container
environment, and the policy check forbids it.
A World0 credential must never exist in the dev or stage namespaces, and no dev or
stage credential may reach the World0 database. Rotate by replacing the Secret and
@@ -58,7 +73,8 @@ Run this once per disposable environment (`dev`, then `stage`).
**1. Label the store node, and apply the storage class and claim.**
```sh
# Label exactly one worker (worker-1 or worker-2; never worker-3 or the control plane).
# Label exactly one worker. The maintainer allows any worker (never the control plane);
# worker-1 is chosen (lowest measured latency; worker-3's disk is 87 % full).
kubectl label node rke2-worker-1 aevolution.io/stores=true
kubectl apply -f deploy/kubernetes/platform/storage/storageclass.yaml
kubectl apply -k deploy/kubernetes/platform/dev # adds the aevolution-objects claim
+1 -1
View File
@@ -191,7 +191,7 @@ epoch.
Create Secret **evolution-postgres-migrator** in evolution-dev outside Git. Keys:
`pg_service.conf`, `pgpass`, `ca.crt`. The service file has section
`[evolution-migrator]` with host, numeric hostaddr, port, dbname, user,
`[evolution]` (the same section name in every login Secret, M8.3) with host, numeric hostaddr, port, dbname, user,
sslmode=verify-full, sslrootcert=/run/postgres/ca.crt and connect_timeout=5.
pgpass uses libpq's escaped host:port:database:user:password format. Do not paste
values into chat, manifests or image arguments. Configure cluster Secret RBAC and