feat(operator)!: add scoped leader election#1192
Merged
Merged
Conversation
- Introduced `LeaderElectionType.Scoped` for namespace-partitioned leadership. - Added `ScopeAwareResourceWatcher` and `ScopeAwareEntityQueueBackgroundService` to enhance multi-instance responsibility handling. - Implemented `ILeadershipScope` for user-defined namespace responsibility coordination. - Updated tests and registration validation for scoped leader election. - Revised documentation for `LeaderElectionType.Scoped`, including setup and behavior details.
…ope handling - Replaced `LeadershipScopeChange` with `NamespacedLeadershipScope` for better abstraction and to enable partitioning by Kubernetes namespaces. - Updated `ILeadershipScope` to handle entity-based responsibility instead of namespaces. - Refactored scope-aware components to align with the new abstraction. - Adjusted tests for `ScopeAwareEntityQueueBackgroundService`, `ScopeAwareResourceWatcher`, and related entities to use the new structure. - Removed redundant namespace-focused logic for cleaner and more flexible resync mechanisms.
…nce leadership scope handling - Introduced `ShouldReconcileAsync` to allow entity-based reconciliation veto decisions. - Updated `ScopeAwareEntityQueueBackgroundService` to base leadership responsibility on current entity state. - Added tests to validate scoped reconciliation decisions for added, modified, and deleted entities. - Enhanced test coverage with `ScopeAwareSharedResourceWatcher`. - Optimized `ScopeAwareEntityQueueBackgroundService` by removing redundant responsibility checks.
…methods - Extended `List`, `ListAsync`, and `Watch` methods to accept field selectors. - Updated label and field selector handling with `KubernetesSelector` for better filtering capabilities. - Adjusted positional overloads to align with Kubernetes client parameter conventions. - Revised test coverage to validate new selector functionality. - Updated migration documentation with required changes for v13 compatibility.
… unchanged generation - Fixed regression where reacquired entities with unchanged generation were skipped during scope resync. - Dropped deduplication tokens for entity types on scope change to force reconciliation for all in-scope entities. - Updated `ScopeAwareResourceWatcher` with enhanced cache handling to prevent missed reconciliations. - Added regression test to validate behavior during scope transitions.
kimpenhaus
marked this pull request as ready for review
July 11, 2026 22:23
…ions` utility - Added `ToExpressions` extension method for splitting label and field selectors. - Updated `List`, `ListAsync`, and `Watch` methods to use the new utility, improving readability and reducing duplication. - Introduced unit tests for `ToExpressions` to validate selector transformation behavior.
kimpenhaus
enabled auto-merge (squash)
July 11, 2026 22:52
This was referenced Jul 15, 2026
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
Adds scoped leader election for partitioning entity responsibility across operator instances while retaining the standard watcher, queue, selector, and reconciliation pipeline.
Also adds field-selector support to Kubernetes client list and synchronous watch operations.
Breaking changes