Skip to content

Fix kueue updates and improve reconciler#63

Open
tkatila wants to merge 4 commits into
intel:mainfrom
tkatila:fix-kueue-updates-faster-reconciler
Open

Fix kueue updates and improve reconciler#63
tkatila wants to merge 4 commits into
intel:mainfrom
tkatila:fix-kueue-updates-faster-reconciler

Conversation

@tkatila

@tkatila tkatila commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Retrieving CRDs seems to be slow and misc_controller was querying them many times. By retrieving them once, makes misc_controller reconciler much faster.

@tkatila
tkatila requested a review from pfl as a code owner July 21, 2026 11:21
@tkatila
tkatila requested a review from Copilot July 21, 2026 11:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

This PR optimizes the misc controller reconcile flow by retrieving the cluster’s CRD names once per ClusterPolicy reconcile and reusing the result, while also improving Kueue object reconciliation to update labels consistently and clean up stale queues.

Changes:

  • Retrieve CRD name list once in ClusterPolicyReconciler and pass it into MiscReconciler to avoid repeated CRD listing.
  • Improve Kueue reconciliation by ensuring owner labeling is applied/updated and by deleting stale ClusterQueues/LocalQueues when policy changes.
  • Add tests for stale Kueue queue cleanup and for using APIReader during LocalQueue cleanup.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
internal/controller/misc_controller.go Reworks CRD existence checks to use pre-fetched CRD names, adds Kueue stale-queue cleanup, and updates label handling + LocalQueue listing via APIReader.
internal/controller/clusterpolicy_controller.go Fetches CRD names once per reconcile and passes them into sub-reconcilers; wires APIReader from manager.
internal/controller/misc_controller_test.go Updates tests for new owner-label behavior and adds coverage for stale queue cleanup + APIReader usage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/controller/misc_controller.go
Comment thread internal/controller/misc_controller.go
Comment thread internal/controller/misc_controller.go
Comment thread internal/controller/clusterpolicy_controller.go Outdated
@tkatila
tkatila force-pushed the fix-kueue-updates-faster-reconciler branch from 0654908 to d0a2d8c Compare July 21, 2026 12:33
tkatila added 4 commits July 21, 2026 15:41
When clusterpolicy was edited with different localqueues,
controller left previous queues in the cluster. They should be
removed.

Signed-off-by: Tuomas Katila <tuomas.katila@intel.com>
Operator uses a cached client to list cluster objects.
As LocalQueues were not requested to be cached, they couldn't
be listed with the client. ClusterQueues are cluster-wide
so they seem to be cache by default, so they were found
correctly.

Signed-off-by: Tuomas Katila <tuomas.katila@intel.com>
misc controller has conditional paths that depend
on CRDs installed to the cluster. Misc controller
queried CRDs a few times which resulted in misc controller
being slow. The difference is a few seconds on my test
bench.

Signed-off-by: Tuomas Katila <tuomas.katila@intel.com>
Signed-off-by: Tuomas Katila <tuomas.katila@intel.com>
@tkatila
tkatila force-pushed the fix-kueue-updates-faster-reconciler branch from d0a2d8c to 46e1a99 Compare July 21, 2026 12:42
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.

2 participants