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:
@@ -0,0 +1,23 @@
|
||||
# Egress from migrate, store-check and region pods to exactly the AEvolution
|
||||
# PostgreSQL VM (pg-forge-01) and nothing else (ADR-0070).
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: NetworkPolicy
|
||||
metadata:
|
||||
name: aevolution-database-egress
|
||||
labels:
|
||||
app.kubernetes.io/part-of: aevolution
|
||||
annotations:
|
||||
argocd.argoproj.io/sync-wave: "-1"
|
||||
spec:
|
||||
podSelector:
|
||||
matchExpressions:
|
||||
- key: app.kubernetes.io/component
|
||||
operator: In
|
||||
values: [migrate, store-check, region]
|
||||
policyTypes: [Egress]
|
||||
egress:
|
||||
- to:
|
||||
- ipBlock:
|
||||
cidr: 172.10.1.127/32
|
||||
ports:
|
||||
- {protocol: TCP, port: 5432}
|
||||
@@ -0,0 +1,12 @@
|
||||
# M8.3 store Jobs as Argo CD hooks (ADR-0070 amendment). Included by an
|
||||
# environment's workload path through its overlay (stores/dev, stores/stage), which
|
||||
# pins the image digests and names the environment's NOLOGIN runtime role.
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources:
|
||||
- database-egress.yaml
|
||||
- migrate-job.yaml
|
||||
- store-check-job.yaml
|
||||
labels:
|
||||
- pairs:
|
||||
app.kubernetes.io/part-of: aevolution
|
||||
@@ -0,0 +1,60 @@
|
||||
# PreSync hook: every sync of the environment first migrates its database with the
|
||||
# migrator login (version pin and runtime privilege audit included); a failure
|
||||
# stops the sync before anything else changes.
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: aevolution-db-migrate
|
||||
labels:
|
||||
app.kubernetes.io/part-of: aevolution
|
||||
app.kubernetes.io/component: migrate
|
||||
annotations:
|
||||
argocd.argoproj.io/hook: PreSync
|
||||
argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
|
||||
spec:
|
||||
backoffLimit: 0
|
||||
activeDeadlineSeconds: 180
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/part-of: aevolution
|
||||
app.kubernetes.io/component: migrate
|
||||
spec:
|
||||
serviceAccountName: aevolution-migrator
|
||||
automountServiceAccountToken: false
|
||||
restartPolicy: Never
|
||||
securityContext:
|
||||
runAsNonRoot: true
|
||||
runAsUser: 10001
|
||||
runAsGroup: 10001
|
||||
fsGroup: 10001
|
||||
seccompProfile: {type: RuntimeDefault}
|
||||
containers:
|
||||
- name: migrate
|
||||
image: aevolution-postgres-tools
|
||||
env:
|
||||
- {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: set-by-overlay}
|
||||
resources:
|
||||
requests: {cpu: 100m, memory: 64Mi}
|
||||
limits: {memory: 128Mi}
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
readOnlyRootFilesystem: true
|
||||
capabilities: {drop: [ALL]}
|
||||
volumeMounts:
|
||||
- {name: connection, mountPath: /run/postgres, readOnly: true}
|
||||
- {name: scratch, mountPath: /tmp}
|
||||
volumes:
|
||||
- name: connection
|
||||
secret:
|
||||
secretName: evolution-postgres-migrator
|
||||
defaultMode: 0440
|
||||
items:
|
||||
- {key: pg_service.conf, path: pg_service.conf}
|
||||
- {key: pgpass, path: pgpass}
|
||||
- {key: ca.crt, path: ca.crt}
|
||||
- name: scratch
|
||||
emptyDir: {medium: Memory, sizeLimit: 8Mi}
|
||||
@@ -0,0 +1,72 @@
|
||||
# PostSync hook: qualifies the object volume and the runtime login after each sync
|
||||
# (evo-world-clone check-store, ADR-0070). Its log is the store evidence.
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: aevolution-store-check
|
||||
labels:
|
||||
app.kubernetes.io/part-of: aevolution
|
||||
app.kubernetes.io/component: store-check
|
||||
annotations:
|
||||
argocd.argoproj.io/hook: PostSync
|
||||
argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
|
||||
spec:
|
||||
backoffLimit: 0
|
||||
activeDeadlineSeconds: 120
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/part-of: aevolution
|
||||
app.kubernetes.io/component: store-check
|
||||
spec:
|
||||
serviceAccountName: aevolution-region
|
||||
automountServiceAccountToken: false
|
||||
restartPolicy: Never
|
||||
nodeSelector:
|
||||
aevolution.io/stores: "true"
|
||||
securityContext:
|
||||
runAsNonRoot: true
|
||||
runAsUser: 10001
|
||||
runAsGroup: 10001
|
||||
fsGroup: 10001
|
||||
seccompProfile: {type: RuntimeDefault}
|
||||
containers:
|
||||
- name: check-store
|
||||
image: aevolution-server
|
||||
# libpq ignores a group-readable password file, and Secret volumes are
|
||||
# group-readable for a non-root fsGroup, so copy it to private memory first.
|
||||
# w1/r1 is a reserved probe namespace, never a real world.
|
||||
command: ["/bin/bash", "-c"]
|
||||
args:
|
||||
- |
|
||||
set -eu
|
||||
umask 077
|
||||
cp /run/postgres/pgpass /tmp/pgpass
|
||||
exec /usr/local/bin/evo-world-clone check-store --world 1 --region 1 \
|
||||
--objects /objects --pg-service /run/postgres/pg_service.conf \
|
||||
--pg-passfile /tmp/pgpass
|
||||
resources:
|
||||
requests: {cpu: 50m, memory: 64Mi}
|
||||
limits: {memory: 256Mi}
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
readOnlyRootFilesystem: true
|
||||
capabilities: {drop: [ALL]}
|
||||
volumeMounts:
|
||||
- {name: objects, mountPath: /objects}
|
||||
- {name: connection, mountPath: /run/postgres, readOnly: true}
|
||||
- {name: scratch, mountPath: /tmp}
|
||||
volumes:
|
||||
- name: objects
|
||||
persistentVolumeClaim:
|
||||
claimName: aevolution-objects
|
||||
- name: scratch
|
||||
emptyDir: {medium: Memory, sizeLimit: 1Mi}
|
||||
- name: connection
|
||||
secret:
|
||||
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}
|
||||
@@ -0,0 +1,23 @@
|
||||
# Store Jobs for evolution-dev. Values still to supply before this is included in
|
||||
# the dev workload path: the published registry digests (from the CI Publish
|
||||
# step's "Digest:" line) and the dev database's NOLOGIN runtime group role.
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
namespace: evolution-dev
|
||||
resources:
|
||||
- ../base
|
||||
images:
|
||||
- name: aevolution-postgres-tools
|
||||
newName: registry.aeternalisgames.com/aeternalis/aevolution-postgres-tools
|
||||
digest: sha256:REPLACE_PUBLISHED_TOOLS_DIGEST
|
||||
- name: aevolution-server
|
||||
newName: registry.aeternalisgames.com/aeternalis/aevolution-server
|
||||
digest: sha256:REPLACE_PUBLISHED_SERVER_DIGEST
|
||||
patches:
|
||||
- target:
|
||||
kind: Job
|
||||
name: aevolution-db-migrate
|
||||
patch: |-
|
||||
- op: replace
|
||||
path: /spec/template/spec/containers/0/env/3/value
|
||||
value: REPLACE_DEV_RUNTIME_GROUP_ROLE
|
||||
@@ -0,0 +1,23 @@
|
||||
# Store Jobs for evolution-stage. Values still to supply before this is included in
|
||||
# the stage workload path: the published registry digests (from the CI Publish
|
||||
# step's "Digest:" line) and the stage database's NOLOGIN runtime group role.
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
namespace: evolution-stage
|
||||
resources:
|
||||
- ../base
|
||||
images:
|
||||
- name: aevolution-postgres-tools
|
||||
newName: registry.aeternalisgames.com/aeternalis/aevolution-postgres-tools
|
||||
digest: sha256:REPLACE_PUBLISHED_TOOLS_DIGEST
|
||||
- name: aevolution-server
|
||||
newName: registry.aeternalisgames.com/aeternalis/aevolution-server
|
||||
digest: sha256:REPLACE_PUBLISHED_SERVER_DIGEST
|
||||
patches:
|
||||
- target:
|
||||
kind: Job
|
||||
name: aevolution-db-migrate
|
||||
patch: |-
|
||||
- op: replace
|
||||
path: /spec/template/spec/containers/0/env/3/value
|
||||
value: REPLACE_STAGE_RUNTIME_GROUP_ROLE
|
||||
@@ -1,163 +0,0 @@
|
||||
# M8.3 store Jobs for ONE disposable environment (dev or stage). Not an Argo path.
|
||||
# Copy, then replace every REPLACE_* marker (the markers make this file unappliable
|
||||
# as committed), and apply by hand:
|
||||
# REPLACE_NAMESPACE evolution-dev | evolution-stage (never evolution-world0)
|
||||
# REPLACE_DB_CIDR the database VM's address as a /32 (PGHOSTADDR)
|
||||
# REPLACE_DB_PORT its port (PGPORT)
|
||||
# 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). 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
|
||||
kind: NetworkPolicy
|
||||
metadata:
|
||||
name: aevolution-database-egress
|
||||
namespace: REPLACE_NAMESPACE
|
||||
labels:
|
||||
app.kubernetes.io/part-of: aevolution
|
||||
spec:
|
||||
podSelector:
|
||||
matchExpressions:
|
||||
- key: app.kubernetes.io/component
|
||||
operator: In
|
||||
values: [migrate, store-check, region]
|
||||
policyTypes: [Egress]
|
||||
egress:
|
||||
- to:
|
||||
- ipBlock:
|
||||
cidr: REPLACE_DB_CIDR
|
||||
ports:
|
||||
- {protocol: TCP, port: REPLACE_DB_PORT}
|
||||
---
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: aevolution-db-migrate
|
||||
namespace: REPLACE_NAMESPACE
|
||||
labels:
|
||||
app.kubernetes.io/part-of: aevolution
|
||||
app.kubernetes.io/component: migrate
|
||||
spec:
|
||||
backoffLimit: 0
|
||||
activeDeadlineSeconds: 180
|
||||
ttlSecondsAfterFinished: 86400
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/part-of: aevolution
|
||||
app.kubernetes.io/component: migrate
|
||||
spec:
|
||||
serviceAccountName: aevolution-migrator
|
||||
automountServiceAccountToken: false
|
||||
restartPolicy: Never
|
||||
securityContext:
|
||||
runAsNonRoot: true
|
||||
runAsUser: 10001
|
||||
runAsGroup: 10001
|
||||
fsGroup: 10001
|
||||
seccompProfile: {type: RuntimeDefault}
|
||||
containers:
|
||||
- name: migrate
|
||||
image: registry.aeternalisgames.com/aeternalis/aevolution-postgres-tools@REPLACE_TOOLS_DIGEST
|
||||
env:
|
||||
- {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}
|
||||
resources:
|
||||
requests: {cpu: 100m, memory: 64Mi}
|
||||
limits: {memory: 128Mi}
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
readOnlyRootFilesystem: true
|
||||
capabilities: {drop: [ALL]}
|
||||
volumeMounts:
|
||||
- {name: connection, mountPath: /run/postgres, readOnly: true}
|
||||
- {name: scratch, mountPath: /tmp}
|
||||
volumes:
|
||||
- name: connection
|
||||
secret:
|
||||
secretName: evolution-postgres-migrator
|
||||
defaultMode: 0440
|
||||
items:
|
||||
- {key: pg_service.conf, path: pg_service.conf}
|
||||
- {key: pgpass, path: pgpass}
|
||||
- {key: ca.crt, path: ca.crt}
|
||||
- name: scratch
|
||||
emptyDir: {medium: Memory, sizeLimit: 8Mi}
|
||||
---
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: aevolution-store-check
|
||||
namespace: REPLACE_NAMESPACE
|
||||
labels:
|
||||
app.kubernetes.io/part-of: aevolution
|
||||
app.kubernetes.io/component: store-check
|
||||
spec:
|
||||
backoffLimit: 0
|
||||
activeDeadlineSeconds: 120
|
||||
ttlSecondsAfterFinished: 86400
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/part-of: aevolution
|
||||
app.kubernetes.io/component: store-check
|
||||
spec:
|
||||
serviceAccountName: aevolution-region
|
||||
automountServiceAccountToken: false
|
||||
restartPolicy: Never
|
||||
nodeSelector:
|
||||
aevolution.io/stores: "true"
|
||||
securityContext:
|
||||
runAsNonRoot: true
|
||||
runAsUser: 10001
|
||||
runAsGroup: 10001
|
||||
fsGroup: 10001
|
||||
seccompProfile: {type: RuntimeDefault}
|
||||
containers:
|
||||
- name: check-store
|
||||
image: registry.aeternalisgames.com/aeternalis/aevolution-server@REPLACE_SERVER_DIGEST
|
||||
# libpq ignores a group-readable password file, and Secret volumes are
|
||||
# group-readable for a non-root fsGroup, so copy it to private memory first.
|
||||
# w1/r1 is a reserved probe namespace, never a real world.
|
||||
command: ["/bin/bash", "-c"]
|
||||
args:
|
||||
- |
|
||||
set -eu
|
||||
umask 077
|
||||
cp /run/postgres/pgpass /tmp/pgpass
|
||||
exec /usr/local/bin/evo-world-clone check-store --world 1 --region 1 \
|
||||
--objects /objects --pg-service /run/postgres/pg_service.conf \
|
||||
--pg-passfile /tmp/pgpass
|
||||
resources:
|
||||
requests: {cpu: 50m, memory: 64Mi}
|
||||
limits: {memory: 256Mi}
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
readOnlyRootFilesystem: true
|
||||
capabilities: {drop: [ALL]}
|
||||
volumeMounts:
|
||||
- {name: objects, mountPath: /objects}
|
||||
- {name: connection, mountPath: /run/postgres, readOnly: true}
|
||||
- {name: scratch, mountPath: /tmp}
|
||||
volumes:
|
||||
- name: objects
|
||||
persistentVolumeClaim:
|
||||
claimName: aevolution-objects
|
||||
- name: scratch
|
||||
emptyDir: {medium: Memory, sizeLimit: 1Mi}
|
||||
- name: connection
|
||||
secret:
|
||||
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