Skip to content

feat(operator)!: support multiple controllers and selectors per entity#1183

Open
kimpenhaus wants to merge 14 commits into
mainfrom
feature/909-multi-selector-per-entity
Open

feat(operator)!: support multiple controllers and selectors per entity#1183
kimpenhaus wants to merge 14 commits into
mainfrom
feature/909-multi-selector-per-entity

Conversation

@kimpenhaus

@kimpenhaus kimpenhaus commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add support for multiple controllers targeting the same entity type.

  • Add [LabelSelector] and [FieldSelector] controller attributes.
  • Add generator error KOG001 for conflicting selector attributes.
  • Add WatchStrategy.PerController and the opt-in SharedPerEntity strategy.
  • Add client-side selector matching through IClientSideEntitySelector<TEntity>.
  • Give each controller its own watcher, queue, and reconciliation pipeline.
  • Share parallelism limits and per-UID locking across controller pipelines.
  • Route EntityQueue<TEntity> requeues to the active controller pipeline.
  • Aggregate queue-depth metrics per entity type.
  • Reject multiple controllers when using custom queue or leader-election strategies.
  • Update tests, migration guidance, and operator documentation.

Closes #909.

Breaking changes

  • Remove IEntityQueueFactory and EntityQueueFactory. Use reconciliation results or the scoped EntityQueue<TEntity> delegate for requeues.
  • Add the required OperatorSettings.WatchStrategy property. Prefer OperatorSettingsBuilder, which supplies the default PerController strategy.
  • Stop registering IReconciler<TEntity> and ITimedEntityQueue<TEntity> in DI for the default in-memory pipeline.
  • Resolving EntityQueue<TEntity> outside a reconciliation scope is ambiguous and throws when multiple controller pipelines exist.
  • Add a cachePartition parameter to custom ResourceWatcher<TEntity> and LeaderAwareResourceWatcher<TEntity> constructors.
  • Add IEntityReconcileCoordinator<TEntity> to custom queue-background-service constructors.
  • Add the concrete controller type to direct Reconciler<TEntity> construction.
  • Report controllers declaring both [LabelSelector] and [FieldSelector] as generator error KOG001.

- Added `WatchStrategy` to `OperatorSettings` with `PerController` (default) and `SharedPerEntity` modes
- Enhanced reconciliation scope to support multiple pipelines for shared watchers
- Updated generator to support label and field selectors for controllers
- Removed `IEntityQueueFactory` and consolidated queue management into `EntityQueue<TEntity>` delegate
- Updated advanced configuration docs to include watch strategy details
# Conflicts:
#	docs/docs/operator/advanced-configuration.mdx
#	docs/docs/operator/building-blocks/controllers.mdx
… structure

- Introduced new "Watch Strategy" section explaining `PerController` and `SharedPerEntity` modes.
- Adjusted sidebar positions for existing configuration topics to accommodate the new section.
- Updated internal links to reference the "Watch Strategy" section.
@kimpenhaus kimpenhaus changed the title feat(operator): implement multiple field/label selector support feat(operator)!: implement multiple field/label selector support Jul 6, 2026
- Documented breaking changes, including `IEntityQueueFactory` removal and scoped `EntityQueue<TEntity>` resolution
- Added migration instructions for custom watcher constructors and reconciliation pipelines
- Highlighted new features, such as multiple controllers per entity and watch strategy configurations
- Linked to release notes for detailed change log
…on validation

- Introduced compile-time error `KOG001` for controllers with conflicting `[LabelSelector]` and `[FieldSelector]`
- Enhanced generator to exclude invalid controllers from registration
- Improved `OperatorBuilder` to validate reconciliation pipeline completeness, including `IReconciler` for custom strategies
- Updated migration guide and documentation to reflect changes
- Added unit tests to ensure generator behavior and pipeline validation
…egies

- Disallowed multiple controllers per entity when using `QueueStrategy.Custom` or `LeaderElectionType.Custom` to prevent silent failures
- Updated documentation to explain new behavior and configuration requirements
- Added unit tests to validate rejection of multiple controller registrations
@kimpenhaus kimpenhaus marked this pull request as ready for review July 7, 2026 20:36
- Deleted `AnalyzerReleases.Shipped.md` and `AnalyzerReleases.Unshipped.md` references
- Cleaned up project file to reduce unnecessary items
- Updated table formatting to align column separators properly
- No functional changes; ensures consistency and readability
…oller entities

- Introduced `EntityReconcileCoordinator<TEntity>` as a single coordinator per entity type
  - Ensures shared parallelism budget across controllers
  - Enforces exclusive per-UID locks globally (not per controller)
- Updated queue background services to utilize the shared coordinator
  - Removed inline semaphore and lock management
- Adjusted tests to validate parallelism cap and UID locking across controllers
- Enhanced documentation to reflect shared parallelism and conflict resolution strategies
@kimpenhaus kimpenhaus changed the title feat(operator)!: implement multiple field/label selector support feat(operator)!: support multiple controllers and selectors per entity Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature]: Multiple entity controllers with different label selectors

1 participant