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:
dingo
2026-09-29 17:05:34 -04:00
co-authored by Claude Opus 5.5
parent 8d594f28af
commit 7318d82a14
20 changed files with 505 additions and 223 deletions
+67 -4
View File
@@ -111,13 +111,27 @@ if policy and binding:
check((resource, 'UPDATE') in covered, f'world0 policy must cover UPDATE {resource}')
text = yaml.safe_dump(spec)
for needle in ("aevolution:world0-break-glass", "evolution-world0", "aevolution-world0",
"aevolution-platform",
"aevolution.io/protected", "Retain"):
check(needle in text, f'world0 policy must reference {needle}')
# Argo CD projects and applications.
for path, doc in objects:
name = doc['metadata'].get('name', '')
if doc['kind'] == 'AppProject' and name.startswith('aevolution-'):
if doc['kind'] == 'AppProject' and name == 'aevolution-platform':
spec = doc['spec']
namespaces = sorted(d.get('namespace') for d in spec.get('destinations', []))
check(namespaces == ['evolution-dev', 'evolution-stage', 'evolution-world0'],
f'{path}: the platform project targets exactly the three AEvolution namespaces')
cluster = sorted((w.get('group'), w.get('kind')) for w in spec.get('clusterResourceWhitelist', []))
check(cluster == [('', 'Namespace'),
('admissionregistration.k8s.io', 'ValidatingAdmissionPolicy'),
('admissionregistration.k8s.io', 'ValidatingAdmissionPolicyBinding'),
('storage.k8s.io', 'StorageClass')],
f'{path}: the platform project may own only its four cluster kinds')
kinds = {w.get('kind') for w in spec.get('namespaceResourceWhitelist', [])}
check(not kinds & {'Secret', 'Role', 'RoleBinding', '*'}, f'{path}: platform whitelists a forbidden kind')
elif doc['kind'] == 'AppProject' and name.startswith('aevolution-'):
env = name[len('aevolution-'):]
spec = doc['spec']
namespaces = [d.get('namespace') for d in spec.get('destinations', [])]
@@ -136,13 +150,21 @@ for path, doc in objects:
spec = doc['spec']
project = spec.get('project', '')
destination = spec.get('destination', {}).get('namespace', '')
check('automated' not in (spec.get('syncPolicy') or {}), f'{path}: {name} must not auto-sync')
automated = (spec.get('syncPolicy') or {}).get('automated')
if name == 'aevolution-platform':
# Self-heal only: never prune, so no Git change can delete durable objects.
check(automated is not None and automated.get('prune') is False,
f'{path}: the platform app self-heals and never prunes')
check(spec.get('source', {}).get('path') == 'deploy/kubernetes/platform/cluster',
f'{path}: the platform app syncs deploy/kubernetes/platform/cluster')
else:
check(automated is None, f'{path}: {name} must not auto-sync')
check('resources-finalizer.argocd.argoproj.io' not in doc['metadata'].get('finalizers', []),
f'{path}: {name} must not cascade-delete')
if project.startswith('aevolution-'):
if project.startswith('aevolution-') and project != 'aevolution-platform':
check(destination == 'evolution-' + project[len('aevolution-'):],
f'{path}: {name} leaves its project environment')
check(destination != 'evolution-world0' or name == 'aevolution-world0',
check(destination != 'evolution-world0' or name in ('aevolution-world0', 'aevolution-platform'),
f'{path}: only aevolution-world0 may target evolution-world0')
# M8.3 storage (ADR-0070): durable volumes retain their data; database passwords are
@@ -170,6 +192,47 @@ for path, doc in objects:
check(doc['metadata'].get('namespace') != 'evolution-world0',
f'{path}: store Jobs never target World0')
# 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',
'the platform bundle must mark every object Prune=false,Delete=false')
check(sorted(bundle.get('resources', [])) == ['../admission', '../dev', '../stage', '../storage', '../world0'],
'the platform bundle must include admission, storage and the three environments')
# Paths a real (non-example) Application syncs must be complete: no REPLACE markers
# anywhere they render, following kustomization resources.
def kustomize_files(directory, seen):
directory = os.path.normpath(directory)
if directory in seen:
return []
seen.add(directory)
found = []
k = os.path.join(directory, 'kustomization.yaml')
if not os.path.isfile(k):
return found
found.append(k)
spec = documents(k)[0]
for entry in spec.get('resources', []) + spec.get('components', []):
target = os.path.normpath(os.path.join(directory, entry))
if os.path.isdir(target):
found += kustomize_files(target, seen)
else:
found.append(target)
return found
for path, doc in objects:
# Examples count too once their path is real (the live dev app is only an example
# here); an example whose path is itself still a marker is not yet deployable.
source_path = doc.get('spec', {}).get('source', {}).get('path', '')
if doc['kind'] == 'Application' and 'REPLACE' not in source_path:
source = os.path.join(ROOT, source_path)
for f in kustomize_files(source, set()):
with open(f, encoding='utf-8') as handle:
check('REPLACE' not in handle.read(),
f'{os.path.relpath(f, ROOT)}: unresolved REPLACE marker in a synced path')
# The live Argo path.
for path, doc in objects:
if path.startswith('deploy/kubernetes/dev/'):