docs(controller-manager): RFC for sharding projects across replicas#640
Open
ecv wants to merge 2 commits into
Open
docs(controller-manager): RFC for sharding projects across replicas#640ecv wants to merge 2 commits into
ecv wants to merge 2 commits into
Conversation
Follow-up to #631. Design proposal to distribute per-project cluster engagements across N controller-manager replicas, cutting the goroutine -stack floor (one reflector set per project, 1.51 GiB at ~395 projects) that #632's managedFields strip does not address. RFC only; no code. Refs #631 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.
Summary
RFC / design proposal (no production code changes) for sharding Project cluster engagements across N controller-manager replicas.
The controller-manager engages one full controller-runtime
cluster.Clusterper Ready Project (cache + informers + reflectors), and with leader election +replicas: 1a single active replica holds them all. This makes the goroutine count and stack memory scale linearly with project count: ~1,100 goroutines/project, 1.51 GiBgo_memstats_stack_inuse_bytesat ~395 projects (#631). #632's managedFields strip cut per-object heap but does not reduce this goroutine-stack floor.The RFC proposes distributing per-project engagements across replicas (active/active) so each pod holds ~projects/N caches → ~1/N of the stack floor per pod.
Document
docs/proposals/shard-projects-across-replicas.mdCovers: the goroutine-stack floor problem, three sharding approaches (static label-selector / hash-based / lease-per-shard) with trade-offs and a recommendation (hash-based via StatefulSet ordinal, HRW hashing), leader-election → active/active migration and failover, a concrete change sketch in
provider.go/controllermanager.go, a metrics-based rollout/validation plan, and open risks (rebalancing churn, lease scoping vs. singleton controllers, webhook traffic, and quota cross-cluster coordination correctness — flagged as highest risk).This is an RFC / design proposal only — no implementation.
Refs #631, follow-up to #632.