Skip to content

Commit 5353a6a

Browse files
committed
Exempt tenant-root from central backend derivation (symmetry with egress guard)
The backend derivation in monitoring.yaml was gated on tracingCentral but not on ne-tenant-root, while the Cilium egress rule (networkpolicy-traces-central.yaml) correctly exempts tenant-root. That asymmetry is a footgun with high blast radius: setting tracingCentral=true on tenant-root would flip its own monitoring to central, suppressing the local 'generic' VictoriaTraces store — the very store every central tenant exports to — black-holing traces cluster-wide. Make the derivation symmetric: tenant-root always resolves to local (it hosts the shared store) regardless of tracingCentral. Test pins root-forced-local; mutation-verified. Signed-off-by: Alexey Artamonov <[email protected]>
1 parent fb0800d commit 5353a6a

2 files changed

Lines changed: 30 additions & 2 deletions

File tree

‎packages/apps/tenant/templates/monitoring.yaml‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,14 @@ spec:
7474
Monitoring app config cannot re-introduce the divergence — central is
7575
reachable only with the egress rule, and clearing tracingCentral forces
7676
the collector back to local. Flux deep-merges maps, so only .backend is
77-
overridden; enabled/replicas/samplingPercentage from the Secret stay. */}}
77+
overridden; enabled/replicas/samplingPercentage from the Secret stay.
78+
tenant-root is exempt (like the egress rule's own ne-tenant-root guard):
79+
it hosts the shared store, so central there would suppress its local
80+
generic backend and black-hole the store every central tenant exports to.
81+
Root therefore always resolves to local regardless of tracingCentral. */}}
7882
values:
7983
tracingCollector:
80-
backend: {{ ternary "central" "local" .Values.tracingCentral }}
84+
backend: {{ ternary "central" "local" (and .Values.tracingCentral (ne (include "tenant.name" .) "tenant-root")) }}
8185
valuesFrom:
8286
- kind: Secret
8387
name: cozystack-values

‎packages/apps/tenant/tests/monitoring_tracing_backend_coupling_test.yaml‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,30 @@ tests:
5252
kind: CiliumClusterwideNetworkPolicy
5353
name: tenant-ktj-egress-traces-central
5454

55+
# tenant-root hosts the shared store; central there would suppress its own local
56+
# generic backend and black-hole the store every central tenant exports to. So
57+
# root always resolves to local, symmetric with the egress rule's ne-tenant-root
58+
# guard — even when tracingCentral is (nonsensically) opted in on root.
59+
- it: forces backend=local on tenant-root even when tracingCentral is set
60+
release:
61+
name: tenant-root
62+
namespace: tenant-root
63+
set:
64+
monitoring: true
65+
tracingCentral: true
66+
asserts:
67+
- template: templates/monitoring.yaml
68+
equal:
69+
path: spec.values.tracingCollector.backend
70+
value: local
71+
# ...and tenant-root never gets the cross-boundary egress rule.
72+
- template: templates/networkpolicy-traces-central.yaml
73+
containsDocument:
74+
apiVersion: cilium.io/v2
75+
kind: CiliumClusterwideNetworkPolicy
76+
name: tenant-root-egress-traces-central
77+
not: true
78+
5579
- it: no monitoring release means no backend to diverge (monitoring off)
5680
set:
5781
monitoring: false

0 commit comments

Comments
 (0)