feat: use shared informers to reduce memory and goroutines#10
Merged
zachsmith1 merged 1 commit intomainfrom Feb 16, 2026
Merged
feat: use shared informers to reduce memory and goroutines#10zachsmith1 merged 1 commit intomainfrom
zachsmith1 merged 1 commit intomainfrom
Conversation
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.
At 200 VCP scale, the dominant cost was informer/listener fanout (O(clusters * resources)) and duplicated controller wiring. Namespace and admission webhook paths were still paying per-cluster overhead, and CRD routing/controller setup had become harder to reason about.
This PR reduces that fanout by moving to shared informer surfaces with cluster-scoped projection, while preserving strict per-cluster isolation semantics.
How It Works
Shared Informer + Cluster-Scoped Views (Namespace and Webhook)
Namespace and webhook managers now rely on shared informer factories and scoped listers/informers instead of spinning per-cluster factories for hot resources.
scopedFactory implementations project a per-cluster view from shared indexes using cluster-label filtering.
Result: one shared watch pipeline for key resources, cluster isolation enforced at projection/lister boundaries.
List-Backed Webhook Configuration Sources
Mutating/validating webhook config sources now read via listers and cache accessors by name+resourceVersion.
They intentionally avoid per-plugin informer handler registration, collapsing listener fanout.
Result: lower goroutine count and less memory pressure in webhook-heavy paths without changing webhook behavior.
CRD Multicluster Routing/Controller Cleanup
CRD routing is refactored to use unified multicluster handling (serveClusterCRD) and clearer controller wiring.
Shared CRD projection/runtime logic is used for cluster-aware lookup and status flow, reducing duplicated control paths.
Result: simpler routing semantics, fewer replicated loops, and better correctness under multicluster churn.
Impact and Verification
Improves scalability by replacing per-cluster informer/controller duplication with shared pipelines plus cluster-scoped projection.
Preserves isolation: CRUD/list/watch behavior remains per-cluster from caller perspective.
Validated with smoke coverage across RBAC, namespace lifecycle, webhook scoping, CRD establish/discovery/update, and 200 VCP memory runs.
Net effect: materially lower goroutine overhead and improved memory profile consistency at high VCP counts.