Add M8.4 region host deployment, provisioning hook and drill

Deploy evo-region per environment (ADR-0071): one replica with the
Recreate strategy (a rolling update would deadlock on the lease),
/readyz readiness, /livez liveness, no CPU limit and a drain inside the
grace period, with the image digest doubling as the build identity. A
new idempotent evo-world-clone provision subcommand creates genesis from
development_opening (byte-identical to the qualification fixture) as a
Sync hook after the migration. Dev and stage paths include their region;
a dev AppProject allows Deployment and Service; region-drill.sh times
rollout and forced-deletion recovery; the policy check enforces the
host's invariants.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-09-29 21:32:56 -04:00
co-authored by Claude Opus 5.5
parent 98240ef96e
commit 8ef69fab1d
27 changed files with 879 additions and 159 deletions
+37 -6
View File
@@ -192,6 +192,36 @@ for path, doc in objects:
check(doc['metadata'].get('namespace') != 'evolution-world0',
f'{path}: store Jobs never target World0')
# M8.4 region host (ADR-0071): one owner at a time, readiness means authority.
for path, doc in objects:
# Overlay patches (region-values.yaml) are partial objects; the base is complete.
if (doc['kind'] == 'Deployment' and doc['metadata'].get('name') == 'evo-region'
and not path.endswith('region-values.yaml')):
spec = doc['spec']
pod = spec['template']['spec']
container = pod['containers'][0]
check(spec.get('replicas') == 1 and spec.get('strategy', {}).get('type') == 'Recreate',
f'{path}: the region host runs one replica with the Recreate strategy')
check(container.get('readinessProbe', {}).get('httpGet', {}).get('path') == '/readyz'
and container.get('livenessProbe', {}).get('httpGet', {}).get('path') == '/livez',
f'{path}: readiness must be /readyz and liveness /livez')
limits = container.get('resources', {}).get('limits', {})
check('cpu' not in limits and 'memory' in limits,
f'{path}: memory limit required, no CPU limit (throttling delays renewals)')
script = ' '.join(container.get('args', []))
drain = [int(x) for x in __import__('re').findall(r'--drain-ms (\d+)', script)]
check(len(drain) == 1 and pod.get('terminationGracePeriodSeconds', 30) * 1000 > drain[0],
f'{path}: the termination grace period must exceed --drain-ms')
for env in ('dev', 'stage'):
overlay = f'deploy/kubernetes/region/{env}/'
images = manifests.get(overlay + 'kustomization.yaml', [{}])[0].get('images', [])
server = [i.get('digest', '') for i in images if i.get('name') == 'aevolution-server']
builds = [v.get('value') for d in manifests.get(overlay + 'region-values.yaml', [])
for c in d['spec']['template']['spec']['containers'] for v in c.get('env', [])
if v.get('name') == 'REGION_BUILD']
check(len(server) == 1 and len(builds) == 2 and all('sha256:' + b == server[0] for b in builds),
f'{overlay}: the build identity must equal the server image digest')
# The platform bundle: every rendered object is protected from prune and deletion.
bundle = manifests.get(platform + '/cluster/kustomization.yaml', [{}])[0]
check(bundle.get('commonAnnotations', {}).get('argocd.argoproj.io/sync-options') == 'Prune=false,Delete=false',
@@ -243,12 +273,13 @@ for path, doc in objects:
# The cleanup tool refuses World0 before kubectl runs (no kubectl on PATH here).
with tempfile.TemporaryDirectory() as empty:
env = dict(os.environ, PATH=empty + os.pathsep + os.path.dirname(sys.executable))
for bad in ('world0', 'evolution-world0', 'World0', 'prod', ''):
result = subprocess.run([shutil.which('bash') or '/bin/bash', os.path.join(ROOT, 'tools/ops/cleanup-environment.sh'), bad],
capture_output=True, text=True, env=env)
check(result.returncode == 2 and ('refused' in result.stderr or 'usage' in result.stderr)
and 'kubectl' not in result.stderr,
f'cleanup must refuse {bad!r} before kubectl (rc={result.returncode})')
for tool in ('tools/ops/cleanup-environment.sh', 'tools/ops/region-drill.sh'):
for bad in ('world0', 'evolution-world0', 'World0', 'prod', ''):
result = subprocess.run([shutil.which('bash') or '/bin/bash', os.path.join(ROOT, tool), bad],
capture_output=True, text=True, env=env)
check(result.returncode == 2 and ('refused' in result.stderr or 'usage' in result.stderr)
and 'kubectl' not in result.stderr,
f'{tool} must refuse {bad!r} before kubectl (rc={result.returncode})')
for message in failures:
print('FAIL', message)