feat: add namespace-scoped silence enforcement (v1alpha2)#698
Open
splattner wants to merge 2 commits into
Open
feat: add namespace-scoped silence enforcement (v1alpha2)#698splattner wants to merge 2 commits into
splattner wants to merge 2 commits into
Conversation
Add a selector-gated, off-by-default multi-tenancy control for the observability.giantswarm.io/v1alpha2 API. When one or more rules are configured, a Silence created in a namespace matching a rule's namespaceSelector gets an authoritative "namespace=<namespace>" matcher (plus any custom matchers from the rule) injected into the Alertmanager silence, so it can only mute alerts from its own namespace. - pkg/enforce: config loader (mounted YAML) + first-match-wins rule evaluation and override-on-collision matcher application - v2 controller: apply enforcement at reconcile time (fail-closed on namespace lookup), emit a MatcherOverridden Event when a user matcher is overridden - alertmanager.NewMatcher: shared match-type conversion helper - Helm: namespaceEnforcement values, ConfigMap, volume mount, checksum rollout; RBAC read access to namespaces (also fixes the pre-existing gap for the namespaceSelector predicate) - Unit + envtest integration tests; README documentation Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The enforcement config loader imports sigs.k8s.io/yaml directly, so `go mod tidy` moves it out of the indirect block. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a selector-gated, off-by-default multi-tenancy control for the
observability.giantswarm.io/v1alpha2API. When one or more rules are configured,a
Silencecreated in a namespace matching a rule'snamespaceSelectorgets anauthoritative
namespace="<namespace>"matcher (plus any custom matchers from therule) injected into the Alertmanager silence — so a silence can only ever mute
alerts belonging to its own namespace.
Why
By default a
Silencein one namespace can mute alerts from any namespace, sincea silence is just a set of Alertmanager matchers. This provides lightweight
namespace isolation for shared-Alertmanager, multi-tenant setups.
How it works
--namespace-enforcement-config), rendered byHelm from
namespaceEnforcementvalues into a ConfigMap.metav1.LabelSelector. A namespace is enforced if it matchesany rule (OR). Empty
rules⇒ no enforcement (the default).matchers apply.
overridden, logged, and surfaced as a
MatcherOverriddenKubernetes Event on theSilence.the silence is not synced.
Example