Repository navigation
Commit 1287f29
committed
fix(monitoring): scope tenant VMAlert to its own rule namespaces
A tenant's VMAlert was rendered with selectAllByDefault and no rule
selector, which by the operator's rules means "select every VMRule in
the cluster". It then evaluated those rules against the tenant's own
vmselect, which only holds that tenant's metrics.
Infrastructure alerts are written as absent(up{job="kubelet"} == 1) and
friends, so they fired in every tenant precisely because the series is
absent there -- the noise reported in #2775: CDI operator is down,
plus Kubelet / KubeAPI / KubeControllerManager / KubeScheduler
disappeared from target discovery. Those rules live outside any tenant
namespace (cozy-monitoring holds 38 of them, cozy-kubevirt-cdi and
cozy-linstor one each), so no change to where they are rendered can fix
this; the selection is what is too wide.
Scope a tenant VMAlert by the namespace.cozystack.io/monitoring label,
the same way vmagent.yaml already scopes scrapes. The label's value
names the tenant whose monitoring stack covers that namespace, so the
selector matches the tenant's own namespace plus any child tenant
inheriting this stack -- exactly the namespaces whose metrics reach this
vmselect. ruleSelector stays unset, so all VMRules in those namespaces
continue to match, tenant-authored ones included.
Root monitoring keeps selectAllByDefault: the infrastructure namespaces
carry no such label, and a selector would silence the platform's own
alerts. Root behaviour is therefore unchanged.
Assisted-By: LLM
Signed-off-by: Myasnikov Daniil <[email protected]>1 parent 67b4e23 commit 1287f29
2 files changed
Lines changed: 74 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
25 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
26 | 54 | | |
27 | 55 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
0 commit comments