kubernetes-sigs / kubernetes-sigs/cluster-api
Extend the ability for CAPI to filter what CRs it reconciles
- Dominant language
- Go
- Stars
- 4.3k
- Forks
- 1.6k
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 113
Description
**User Story**
As an operator
I would like to be able to run multiple instances of CAPI (and its providers) in the management cluster
for operational reasons like multi-tenancy.
As an operator
I would like to be able to have more control over which CRs instances of CAPI controllers watch & reconcile
for operational reasons like multi-tenancy.
**Detailed Description**
As a result of #4119 (issue #4004) it's possible to tell instances of CAPI to only reconcile CRs that have a specific value for the `cluster.x-k8s.io/watch-label` label. This means when filtering that every instance of CAPI must correspond to a specific value for this filter.
It is not currently possible to say instance 1 of CAPI reconciles CRs with a label value `val1` and instance 2 of CAPI reconciles CRs where the label value is not `val1`.
It would be good to have the ability to provide a wider range of "filters". For my scenario, i'm interested in having support for `==` and `!=` but it could easily be `||` or `&&`.
**Anything else you would like to add:**
The current filtering based on the label (and the `WatchFilterValue`) is limited by the allowed characters for the label value (i.e. `!` `=` `&&` are not supported) and that its a single label.
One option to support `!=` is to look for a prefix in the label value like: `cluster.x-k8s.io/watch-label: not system`. But this seems less than ideal for a number of reasons.
Another option is that we support label selectors (or some other mechanism) in the CAPI controllers.
/kind feature
Contributor guide
Research direction
Start with the existing watch-label filtering and WatchFilterValue behavior described in the issue. Review how controller instances receive their filters, then assess support for selectors such as == and != across labels. Done means separate CAPI instances can reconcile matching and non-matching CRs without relying on unsupported label-value characters.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, kubernetes
- Domain
- infrastructure
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100