Add M8.5 observability: pinned Prometheus, tested alerts, capacity metrics
An AEvolution-only Prometheus 3.13.3 and Alertmanager 0.34.1, pinned by digest and delivered by Argo (ADR-0072), scrape each region's operations Service through static targets (no API access, no RBAC); the region namespaces admit port 9100 from Prometheus only. Sixteen alert rules cover authority, lease, commits, backlog and object capacity and are proven by promtool injection tests in CI with tools copied from the same pinned images. Two new gauges expose object volume free space and the reserve. Alerts route to a null receiver until a destination is chosen; no broker is adopted and the database outbox stays. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -121,8 +121,8 @@ for path, doc in objects:
|
||||
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')
|
||||
check(namespaces == ['aevolution-monitoring', 'evolution-dev', 'evolution-stage', 'evolution-world0'],
|
||||
f'{path}: the platform project targets exactly the AEvolution namespaces')
|
||||
cluster = sorted((w.get('group'), w.get('kind')) for w in spec.get('clusterResourceWhitelist', []))
|
||||
check(cluster == [('', 'Namespace'),
|
||||
('admissionregistration.k8s.io', 'ValidatingAdmissionPolicy'),
|
||||
@@ -131,6 +131,11 @@ for path, doc in objects:
|
||||
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 == 'aevolution-monitoring':
|
||||
spec = doc['spec']
|
||||
check([d.get('namespace') for d in spec.get('destinations', [])] == ['aevolution-monitoring']
|
||||
and spec.get('clusterResourceWhitelist') == [],
|
||||
f'{path}: monitoring targets only its namespace, with no cluster kinds')
|
||||
elif doc['kind'] == 'AppProject' and name.startswith('aevolution-'):
|
||||
env = name[len('aevolution-'):]
|
||||
spec = doc['spec']
|
||||
@@ -161,7 +166,7 @@ for path, doc in objects:
|
||||
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-') and project != 'aevolution-platform':
|
||||
if project.startswith('aevolution-') and project not in ('aevolution-platform', 'aevolution-monitoring'):
|
||||
check(destination == 'evolution-' + project[len('aevolution-'):],
|
||||
f'{path}: {name} leaves its project environment')
|
||||
check(destination != 'evolution-world0' or name in ('aevolution-world0', 'aevolution-platform'),
|
||||
@@ -222,12 +227,24 @@ for env in ('dev', 'stage'):
|
||||
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')
|
||||
|
||||
# M8.5 monitoring (ADR-0072): third-party images are pinned by digest, and Prometheus
|
||||
# needs no Kubernetes API access.
|
||||
for path, doc in objects:
|
||||
if path.startswith('deploy/kubernetes/monitoring/') and doc['kind'] == 'Deployment':
|
||||
pod = doc['spec']['template']['spec']
|
||||
for container in pod['containers']:
|
||||
check('@sha256:' in container.get('image', ''), f'{path}: {container["name"]} must be pinned by digest')
|
||||
check(pod.get('automountServiceAccountToken') is False, f'{path}: monitoring pods mount no token')
|
||||
if path.startswith('deploy/') and doc['kind'] in ('ClusterRole', 'ClusterRoleBinding', 'Role', 'RoleBinding'):
|
||||
check(False, f'{path}: AEvolution grants no Kubernetes RBAC')
|
||||
|
||||
# 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')
|
||||
check(sorted(bundle.get('resources', [])) == ['../admission', '../dev', '../monitoring', '../stage', '../storage',
|
||||
'../world0'],
|
||||
'the platform bundle must include admission, storage, the environments and monitoring')
|
||||
|
||||
|
||||
# Paths a real (non-example) Application syncs must be complete: no REPLACE markers
|
||||
|
||||
Reference in New Issue
Block a user