Skip to content

Conversation

@Singularity23x0
Copy link
Contributor

@Singularity23x0 Singularity23x0 commented Dec 30, 2025

What type of PR is this?

/kind feature

What this PR does / why we need it:

Adds workloadAssignedQueues tracking to the scheduler cache, by analogy to what 7915 and its successor have are implementing for the queue cache.
This change will be followed up by changing the assumedWorkloads map to a structure holding only boolean information on whether a wl has been assumed, to avoid data redundancy and conflicts, as workloadAssignedQueues will already be providing the queue assignment mappings.

Which issue(s) this PR fixes:

Part 2.1 of addressing: #5310

Special notes for your reviewer:

Does this PR introduce a user-facing change?

NONE

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none Denotes a PR that doesn't merit a release note. kind/feature Categorizes issue or PR as related to a new feature. labels Dec 30, 2025
@netlify
Copy link

netlify bot commented Dec 30, 2025

Deploy Preview for kubernetes-sigs-kueue canceled.

Name Link
🔨 Latest commit 4879555
🔍 Latest deploy log https://app.netlify.com/projects/kubernetes-sigs-kueue/deploys/695f913dc58d9900085983ec

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Dec 30, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Singularity23x0
Once this PR has been reviewed and has the lgtm label, please assign mimowo for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Dec 30, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @Singularity23x0. Thanks for your PR.

I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Dec 30, 2025
@Singularity23x0 Singularity23x0 marked this pull request as ready for review December 31, 2025 09:55
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 31, 2025
@tenzen-y
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Dec 31, 2025
func (c *Cache) addOrUpdateWorkloadToQueue(log logr.Logger, w *kueue.Workload, cq *clusterQueue) error {
wlKey := workload.Key(w)

if err := c.purgeSavedWorkloadData(log, wlKey); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we don't need to call it there. We'll just override the current values with new ones, and the cq.addOrUpdateWorkload has built-in delete

Comment on lines +635 to +640
if !assignded {
return errors.New("workload assumed but not assigned to any queue")
}
if assumedCQ != assignedCQ {
return fmt.Errorf("workload assumed to %s but assigned to %s", assumedCQ, assignedCQ)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure if this is the right behavior. Why don't we delete the assumedCQ/assignedCQ anyway even if they differ/assignedCQ is not present?

}

func (c *Cache) purgeSavedWorkloadData(log logr.Logger, wlKey workload.Reference) error {
assignedCQ, assignded := c.workloadAssignedQueues[wlKey]
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
assignedCQ, assignded := c.workloadAssignedQueues[wlKey]
assignedCQ, assigned := c.workloadAssignedQueues[wlKey]

}

func (c *Cache) UpdateWorkload(log logr.Logger, oldWl, newWl *kueue.Workload) error {
func (c *Cache) UpdateWorkload(log logr.Logger, wl *kueue.Workload) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

After the changes UpdateWorkload looks very similar to AddOrUpdateWorkload. Do we have plans for consolidating those two in a follow-up?

@PBundyra
Copy link
Contributor

PBundyra commented Jan 9, 2026

Please rebase on #8474 once it's merged

@k8s-ci-robot
Copy link
Contributor

@Singularity23x0: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-kueue-test-e2e-main-1-35 4879555 link true /test pull-kueue-test-e2e-main-1-35

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants