Files
cozystack/hack/testdata
Yan Bondarenko 5d54e94b84 feat(monitoring): alert when a namespace stays in Terminating
A namespace that never finished deleting raised no alert of its own.
A tenant namespace deleted directly, not through its Tenant, stayed in
Terminating for about 28 hours while the finalizer of a Kamaji
TenantControlPlane inside it waited for a DataStore secret after the
tenant etcd was gone. The only signal was HelmReleaseNotReady of the
tenant release, which kept flapping.

kube-state-metrics exports kube_namespace_status_phase with a
Terminating series per namespace that is 1 while it is being deleted.
The rule takes the maximum per cluster and namespace, so the timer
survives kube-state-metrics moving to another node, which changes its
node and pod target labels. Healthy deletions finish in under a minute,
and in about five for a tenant with a Kubernetes cluster, a VM and
Postgres inside, so 30 minutes leaves wide room and still reports a
stuck namespace within the hour.

Alerta builds the resource from exported_instance and deduplicates on
environment, resource and event, without the cluster tag. With only
the namespace there, two clusters with a stuck namespace of the same
name became one Alerta alert, and the resolve from one cluster closed
it while the other namespace was still terminating. The resource is
now cluster/namespace.

Assisted-by: LLM
Signed-off-by: Yan Bondarenko <202671653+yankawai@users.noreply.github.com>
2026-11-24 22:04:24 +01:00
..