fix(rbg-controller): watch owned RoleBasedGroupScalingAdapter resources#241
fix(rbg-controller): watch owned RoleBasedGroupScalingAdapter resources#241Syspretor merged 2 commits intosgl-project:mainfrom
Conversation
Add .Owns(&RoleBasedGroupScalingAdapter{}) to SetupWithManager so the
RBG controller is notified when an RBGSA is deleted or modified.
Without this, the controller only discovers RBGSA changes on its next
unrelated reconcile, leaving stale or missing adapters undetected.
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
There was a problem hiding this comment.
Pull request overview
This PR updates the RoleBasedGroup (RBG) controller wiring so that it will reconcile when its owned RoleBasedGroupScalingAdapter (RBGSA) resources change (notably when an adapter is manually deleted), and extends the unit test to validate the created adapter’s owner reference.
Changes:
- Add an
.Owns(&RoleBasedGroupScalingAdapter{}, builder.MatchEveryOwner)watch to the RBG controller. - Extend
ReconcileScalingAdapterunit test assertions to check the adapter has an OwnerReference pointing back to the RBG.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| internal/controller/workloads/rolebasedgroup_controller.go | Adds an Owns() watch for RoleBasedGroupScalingAdapter using MatchEveryOwner. |
| internal/controller/workloads/rolebasedgroup_controller_test.go | Enhances scaling-adapter reconcile test to assert OwnerReference fields exist/match. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
I left a few comments on the main risks below. |
…ry reconciles Add RBGScalingAdapterPredicate alongside MatchEveryOwner so that RBGSA status-only updates (bind/scale) no longer trigger RBG reconciliation. MatchEveryOwner is retained because RBGSA owner references do not set Controller: true. Also improve test coverage: add TypeMeta to test RBG and validate APIVersion/Kind in owner reference assertions.
Summary
.Owns(&RoleBasedGroupScalingAdapter{}, builder.MatchEveryOwner)to the RBG controller'sSetupWithManagerMatchEveryOwnerbecause RBGSA owner references don't setController: true, so the default.Owns()would silently never triggerTest plan