Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add controller sharding capability based on label selector #3731

Closed
5 tasks done
stefanprodan opened this issue Mar 29, 2023 · 0 comments
Closed
5 tasks done

Add controller sharding capability based on label selector #3731

stefanprodan opened this issue Mar 29, 2023 · 0 comments
Labels
umbrella-issue Umbrella issue for tracking progress of a larger effort
Milestone

Comments

@stefanprodan
Copy link
Member

stefanprodan commented Mar 29, 2023

Add --watch-label-selector=<selector expression> flag to all Flux controller using the new watch package from fluxcd/pkg/runtime and wired the selector in each controller's cache manager.

This enables horizontal scaling of Flux controllers, where each controller can be deployed multiple times with a unique label selector which is used as the sharding key.

For example, to shard the reconciliation of HelmReleases in a cluster, user will deploy two extra helm-controller instances:

  • Deployment/helm-controller with --watch-label-selector=sharding.fluxcd.io/shard notin (shard1, shard2)
  • Deployment/helm-controller-1 with --watch-label-selector=sharding.fluxcd.io/shard=shard1
  • Deployment/helm-controller-2 with --watch-label-selector=sharding.fluxcd.io/shard=shard2

By labeling HelmReleases with sharding.fluxcd.io/shard, users can spread the load between helm-controller-1 and helm-controller-2 by setting the label value to shard1 or shard2. HelmReleases which don't have the sharding.fluxcd.io/shard label, will be reconcile by the helm-controller default instance.

Sharding source-controller works the same but users will have to create a matching Kubernetes Service for each SC deployment, then set the Service name in storage address flag. Example:

  • Deployment+Service source-controller-1 with:
--storage-adv-addr=source-controller-1.$(RUNTIME_NAMESPACE).svc.cluster.local.
--watch-label-selector=sharding.fluxcd.io/shard=shard1
  • Deployment+Service source-controller-2 with:
--storage-adv-addr=source-controller-2.$(RUNTIME_NAMESPACE).svc.cluster.local.
--watch-label-selector=sharding.fluxcd.io/shard=shard12

Tasks:

@stefanprodan stefanprodan added the umbrella-issue Umbrella issue for tracking progress of a larger effort label Mar 29, 2023
@stefanprodan stefanprodan added this to the Bootstrap GA milestone Mar 29, 2023
@hiddeco hiddeco closed this as completed Mar 31, 2023
makkes pushed a commit to fluxcd/website that referenced this issue Apr 3, 2023
refs fluxcd/flux2#3731

Signed-off-by: Max Jonas Werner <mail@makk.es>
makkes pushed a commit to fluxcd/website that referenced this issue Apr 5, 2023
refs fluxcd/flux2#3731

Signed-off-by: Max Jonas Werner <mail@makk.es>
makkes pushed a commit to fluxcd/website that referenced this issue Apr 5, 2023
refs fluxcd/flux2#3731

Signed-off-by: Max Jonas Werner <mail@makk.es>
makkes pushed a commit to fluxcd/website that referenced this issue Apr 5, 2023
refs fluxcd/flux2#3731

Signed-off-by: Max Jonas Werner <mail@makk.es>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
umbrella-issue Umbrella issue for tracking progress of a larger effort
Projects
None yet
Development

No branches or pull requests

2 participants