fix(deploy): constrain DEV workloads to worker nodes
Foundation / checks (checks) (push) Successful in 4s
Foundation / checks (client) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 5s
Foundation / checks (network) (push) Successful in 4s
Foundation / checks (postgres) (push) Successful in 5s
Foundation / checks (tsan) (push) Successful in 4s
Foundation / checks (deploy) (push) Successful in 4m24s
Foundation / postgres-tools (push) Successful in 6s
Foundation / server-image (push) Successful in 5s
Foundation / image (push) Successful in 6s

This commit is contained in:
dingo
2026-10-19 15:08:00 -04:00
parent dc7c0e1fa1
commit fad79973e2
14 changed files with 223 additions and 2 deletions
+18
View File
@@ -22,6 +22,8 @@ environment-isolation or World0-protection invariant is broken:
- scheduling (ADR-0076): every pod that mounts the node-local objects volume
selects the store node; aevolution.io/compute is only ever preferred, never
required; upgrade-rehearsal flags never appear in a deployed workload;
- DEV placement (ADR-0170): every required node-affinity alternative excludes
both control-plane roles; direct nodeName bypasses are forbidden;
- the Pods the backup and barrier scripts generate (rendered with --print-manifest)
keep the database-tool security contract: non-root 10001 with fsGroup 10001 so
the 0440 Secret files are readable, no token, read-only root, no escalation;
@@ -672,6 +674,22 @@ for overlay, docs in renders.items():
if expected and kind not in CLUSTER_KINDS:
check(namespace == expected, f'{where}: renders into {namespace}, expected {expected}')
check(kind != 'Secret', f'{where}: rendered Secrets never come from Git')
if namespace == 'evolution-dev' and kind in workload_kinds:
spec = doc.get('spec', {})
pod = (spec.get('jobTemplate', {}).get('spec', {}).get('template', {}).get('spec')
or spec.get('template', {}).get('spec') or spec)
terms = (pod.get('affinity', {}).get('nodeAffinity', {})
.get('requiredDuringSchedulingIgnoredDuringExecution', {})
.get('nodeSelectorTerms', []))
control_roles = {'node-role.kubernetes.io/control-plane', 'node-role.kubernetes.io/master'}
# Selector terms are OR-ed: every possible term must exclude both roles.
excludes_control = bool(terms) and all(
control_roles <= {e.get('key') for e in term.get('matchExpressions', [])
if e.get('operator') == 'DoesNotExist' and not e.get('values')}
for term in terms)
check(excludes_control and not pod.get('nodeName'),
f'{where}: DEV workloads must exclude control-plane and master nodes in every required term '
'and must not bypass scheduling with nodeName')
if kind == 'Deployment' and name == 'evo-region':
pod = doc['spec']['template']['spec']
for container in pod.get('containers', []) + pod.get('initContainers', []):