Skip to content

Commit 7404d6e

Browse files
committed
RFC-0012: Initial commit
1 parent fda72a0 commit 7404d6e

File tree

1 file changed

+100
-0
lines changed
  • rfcs/RFC-0012-wildcard-namespace-support-for-alerts

1 file changed

+100
-0
lines changed
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# RFC-0012 Namespace Wildcard Alert Support
2+
3+
<!--
4+
The title must be short and descriptive.
5+
-->
6+
7+
**Status:** provisional
8+
9+
<!--
10+
Status represents the current state of the RFC.
11+
Must be one of `provisional`, `implementable`, `implemented`, `deferred`, `rejected`, `withdrawn`, or `replaced`.
12+
-->
13+
14+
**Creation date:** 2025-06-29
15+
16+
**Last update:** 2025-06-29
17+
18+
## Summary
19+
20+
Enable `Alert.spec.eventSources[].namespace: "*"` in the FluxCD Notification Controller behind a dedicated feature gate (`--enable-namespace-wildcard-events`) while preserving the global kill-switch (`--no-cross-namespace-refs`) for multi-tenant isolation. This provides cluster-wide alert configuration with minimal operator effort and no additional surface area for secret leakage.
21+
22+
## Motivation
23+
24+
Flux’s Notification Controller today requires one `Alert` per namespace or explicit namespace lists, making cluster-wide error monitoring laborious and brittle. A user-land [PR #504](https://github.com/fluxcd/notification-controller/pull/504) to allow wildcard namespaces has been on hold pending a formal RFC, and [issue #71](https://github.com/fluxcd/notification-controller/issues/71) has long requested this enhancement. Meanwhile, multi-tenant operators rely on `--no-cross-namespace-refs=true` to enforce strict per-namespace boundaries.
25+
26+
27+
### Goals
28+
29+
- **Operator Convenience**: Support a single `Alert` watching all namespaces via `namespace: "*"` without templating per-namespace resources.
30+
- **Opt-in Safety**: Gate wildcard support behind `--enable-namespace-wildcard-events` (default off).
31+
- **Global Kill-Switch**: Honor `--no-cross-namespace-refs=true` to disable wildcard (and all cross-namespace refs) when set.
32+
- **Minimal Surface Area**: No new CRD types or cross-namespace secret reads.
33+
34+
### Non-Goals
35+
36+
- Introducing new CRDs (e.g., `ClusterAlert`).
37+
- Implementing complex cross-namespace authorization (e.g., ReferenceGrant).
38+
- Allowing `Provider` references across namespaces.
39+
40+
## Proposal
41+
42+
1. **New Feature Flag**
43+
- Introduce `--enable-namespace-wildcard-events` (boolean; default `false`).
44+
- When `true`, controllers accept literal `"*"` in `Alert.spec.eventSources[].namespace`.
45+
- When `false`, any `"*"` is rejected during validation with an explicit error.
46+
47+
2. **Interaction with `--no-cross-namespace-refs`**
48+
- `--no-cross-namespace-refs=true` remains the global kill-switch: if set, wildcard is rejected regardless of the new flag.
49+
50+
3. **CRD Validation**
51+
- Update the `Alert` CRD schema (`spec.eventSources[].namespace`) to allow `"*"` only if `--enable-namespace-wildcard-events=true`.
52+
- Webhook returns:
53+
```
54+
spec.eventSources[i].namespace: '*' is not allowed; enable via --enable-namespace-wildcard-events
55+
```
56+
or, if `--no-cross-namespace-refs=true`:
57+
```
58+
spec.eventSources[i].namespace: '*' is disallowed by --no-cross-namespace-refs
59+
```
60+
61+
4. **RBAC Requirements**
62+
- To monitor all namespaces, the controller’s ServiceAccount must have `list,watch` on Flux source CRs (e.g., `GitRepository`, `HelmRelease`) cluster-wide.
63+
- In tenant-isolated installs where the SA lacks these permissions, wildcard support is effectively inert.
64+
65+
5. **Secret Access Boundary**
66+
- Providers continue to reference secrets in their own namespace; no cross-namespace secret reads are introduced by wildcard alerts.
67+
68+
69+
### User Stories
70+
71+
- **Cluster Operator**
72+
> As a cluster operator, I want to define a single Alert in `flux-system` that picks up all HelmRelease failures across every namespace so that I don’t need to manage per-namespace Alert CRDs.
73+
74+
- **Multi-Tenant Admin**
75+
> As a multi-tenant platform admin, I want to ensure that no tenant can enable wildcard alerts unless I explicitly allow it, and I want a single flag (`--no-cross-namespace-refs=true`) to disable all cross-namespace features.
76+
77+
78+
### Alternatives
79+
80+
- **ReferenceGrant-Gated Wildcard**: Leverage Kubernetes ReferenceGrant API for explicit per-namespace grants (rejected due to KEP-3766 closure).
81+
- **Namespace Label Selector**: Use `spec.namespaceSelector` to select labeled namespaces (requires cluster-wide label management).
82+
- **Namespace Regex Matching**: Permit regex patterns in place of exact namespace names (error-prone and overly broad).
83+
- **ClusterAlert CRD**: Introduce a cluster-scoped Alert type (adds new API surface).
84+
- **ResourceSet Templating**: Use Flux ResourceSet to generate per-namespace Alerts (still creates multiple CRs).
85+
86+
87+
## Design Details
88+
89+
- **CLI Changes**: Add `--enable-namespace-wildcard-events` to controller options alongside existing flags like `--no-cross-namespace-refs`.
90+
- **Validation Webhook**: Enforce schema constraint on `namespace` field based on feature gates.
91+
- **Controller Logic**:
92+
- On reconciliation, if wildcard is enabled and not globally disabled, list/watch across all namespaces.
93+
- Otherwise, restrict to the `Alert`’s own namespace.
94+
- **Documentation**: Update [Flux Notification Controller Options](https://fluxcd.io/flux/components/notification/options/) and the Alerts guide to include wildcard examples and flag semantics.
95+
96+
97+
## Implementation History
98+
- **2025-06-29**: Draft RFC-0012 created.
99+
- **TBD**: Feature implementation, tests, docs.
100+
- **TBD**: Community review and merge into `flux2/rfcs`.

0 commit comments

Comments
 (0)