Deliver the platform layer and store Jobs through Argo CD
At the maintainer's request everything but Secrets and the store node label now goes through Argo CD. aevolution-platform syncs one bundle (World0 admission policy, Retain storage class, each environment's namespace, guardrails, service accounts and object claim) with self-heal, no prune and Prune=false,Delete=false on every object; the admission policy also protects the platform app and project. Store Jobs become kustomize components used as PreSync (migrate) and PostSync (check-store) hooks per environment, and the policy check refuses any unresolved marker in a path an Application syncs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -47,68 +47,74 @@ A World0 credential must never exist in the dev or stage namespaces, and no dev
|
||||
stage credential may reach the World0 database. Rotate by replacing the Secret and
|
||||
restarting the consumer.
|
||||
|
||||
## Apply (cluster administrator)
|
||||
## Delivery through Argo CD (maintainer preference, 2026-09-29)
|
||||
|
||||
Everything except Secrets and one node label is delivered from Git by Argo CD.
|
||||
|
||||
**Bootstrap once.** Argo CD cannot create its own first project and application:
|
||||
```sh
|
||||
# 1. Platform guardrails, per environment (dev adds labels, quota and policies to
|
||||
# the existing namespace; its completed proof Job already complies).
|
||||
kubectl apply -k deploy/kubernetes/platform/dev
|
||||
kubectl apply -k deploy/kubernetes/platform/stage
|
||||
kubectl apply -k deploy/kubernetes/platform/world0 # an empty, protected namespace
|
||||
# 2. World0 admission protection (validate first, then apply).
|
||||
kubectl apply --dry-run=server -f deploy/kubernetes/platform/admission/
|
||||
kubectl apply -f deploy/kubernetes/platform/admission/
|
||||
# 3. Projects (resolve the Application paths only when M8.4 adds workloads).
|
||||
kubectl apply -f deploy/argocd/stage/project.yaml.example
|
||||
kubectl apply -f deploy/argocd/world0/project.yaml.example
|
||||
# 4. Verify: reads, can-i and server dry runs only.
|
||||
bash tools/ops/verify-isolation.sh
|
||||
kubectl apply -f deploy/argocd/platform/project.yaml -f deploy/argocd/platform/application.yaml
|
||||
```
|
||||
`aevolution-platform` then syncs `deploy/kubernetes/platform/cluster`:
|
||||
- the World0 admission policy;
|
||||
- the `aevolution-local-retain` storage class;
|
||||
- each environment's namespace, quota, limit range, default-deny policies,
|
||||
service accounts and object claim (dev and stage).
|
||||
|
||||
Create the Secrets listed above in each namespace before any workload syncs.
|
||||
It self-heals, so a deleted quota, policy or label comes back. It never prunes,
|
||||
and every object carries `Prune=false,Delete=false`, so removing a file or
|
||||
deleting the Application never deletes a namespace, claim, class or policy. The
|
||||
admission policy also denies deleting the platform Application or project. Objects
|
||||
applied by hand earlier are adopted (server-side apply).
|
||||
|
||||
**Workloads.** Each environment's Application syncs its path, currently manually:
|
||||
- `aevolution-dev` syncs `deploy/kubernetes/dev`, which is live.
|
||||
- Stage uses `deploy/argocd/stage`, whose path is resolved when its values are
|
||||
supplied.
|
||||
|
||||
The store Jobs (`deploy/kubernetes/stores/<env>`) are included in the environment
|
||||
path as sync hooks:
|
||||
- the database migration runs as a PreSync hook, so a failed migration stops the
|
||||
sync;
|
||||
- `check-store` runs as a PostSync hook.
|
||||
|
||||
An environment's stores overlay is included only once it has its published image
|
||||
digests and its runtime group role. The policy check refuses any `REPLACE_` marker
|
||||
in a synced path.
|
||||
|
||||
**Outside Argo (by design, for now).**
|
||||
- Secrets are created by an operator; a secret manager is in docs/BACKLOG.md.
|
||||
- One node label: `kubectl label node rke2-worker-1 aevolution.io/stores=true`.
|
||||
The maintainer allows any worker; worker-1 is chosen because it had the lowest
|
||||
measured latency, and worker-3's disk is 87 % full.
|
||||
|
||||
**Verify:** `bash tools/ops/verify-isolation.sh` makes only reads, can-i queries and
|
||||
server dry runs.
|
||||
|
||||
## Stores (M8.3, ADR-0070)
|
||||
|
||||
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. 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
|
||||
```
|
||||
|
||||
**2. Prepare the store Jobs.** Copy `deploy/kubernetes/stores/stores.yaml.example`,
|
||||
replace its `REPLACE_*` markers (namespace, database address and port, runtime
|
||||
role, image digests), and create the Secrets above.
|
||||
|
||||
**3. Run and qualify.**
|
||||
```sh
|
||||
kubectl apply -f stores-dev.yaml # policy + both Jobs
|
||||
kubectl logs -n evolution-dev job/aevolution-db-migrate # schema and audit
|
||||
kubectl logs -n evolution-dev job/aevolution-store-check # expect exit 0 and "probe created"
|
||||
```
|
||||
|
||||
Evidence to record in docs/engineering/VALIDATION.md:
|
||||
- **Pod restart:** delete the check Job and apply it again. It must print
|
||||
`probe verified`, with the same digest.
|
||||
- **Missing volume:** run the check with the `objects` volume removed. It must exit
|
||||
4 with `objects refused missing-or-not-a-directory`.
|
||||
- **Full volume:** add `--reserve-mib 1048576` and use a new probe region, such as
|
||||
`--region 2`. It must exit 4 with `probe refused full`.
|
||||
- **Retention:** `kubectl delete pvc aevolution-objects -n evolution-dev`. The PV
|
||||
must become `Released`, not deleted. To rebind:
|
||||
- clear the PV's `spec.claimRef`;
|
||||
- recreate the claim with `volumeName` set to that PV;
|
||||
- rerun the check, which must print `probe verified`.
|
||||
- **Credential rotation:**
|
||||
- Change the runtime login's password on the database VM, and run the check
|
||||
before updating the Secret. It must exit 3 with `database refused connect`.
|
||||
- Update the Secret's `pgpass` and rerun. It must exit 0.
|
||||
- **Privilege boundary:** every run must print
|
||||
Once `deploy/kubernetes/stores/dev` has its values and is included in
|
||||
`deploy/kubernetes/dev`, a manual sync of `aevolution-dev` runs the migration and
|
||||
then the store check. The hook Jobs keep their logs until the next sync. Record
|
||||
this evidence in docs/engineering/VALIDATION.md:
|
||||
- **Pod restart:** sync again. The check must print `probe verified` with the same
|
||||
digest.
|
||||
- **Privilege boundary:** every run prints
|
||||
`database tables=denied functions=reachable`.
|
||||
- **Missing volume:** temporarily remove the `objects` volume in a branch, or run the
|
||||
image by hand without it. The check must exit 4 with
|
||||
`objects refused missing-or-not-a-directory`.
|
||||
- **Full volume:** add `--reserve-mib 1048576` and a new probe region, such as
|
||||
`--region 2`. The check must exit 4 with `probe refused full`.
|
||||
- **Retention:** delete the claim by hand, since Argo never prunes it. The PV must
|
||||
become `Released`, not deleted. To rebind:
|
||||
- clear the PV's `spec.claimRef`;
|
||||
- let the platform app recreate the claim, with `volumeName` pinned in Git;
|
||||
- sync, and check that it prints `probe verified`.
|
||||
- **Credential rotation:**
|
||||
- Change the runtime login's password on the database VM and sync before updating
|
||||
the Secret. The check must exit 3 with `database refused connect`.
|
||||
- Update the Secret's `pgpass` and sync again. It must exit 0.
|
||||
|
||||
## Break-glass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user