Skip to content

Conversation

@andrewseif
Copy link
Contributor

What type of PR is this?

/kind bug

What this PR does / why we need it:

Adding a priority class to a workload (none -> some) is now reconciled, and behaving as explained/expected in the ticket

Which issue(s) this PR fixes:

Fixes #8320

Special notes for your reviewer:

Does this PR introduce a user-facing change?

no

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/bug Categorizes issue or PR as related to a bug. labels Jan 8, 2026
@netlify
Copy link

netlify bot commented Jan 8, 2026

Deploy Preview for kubernetes-sigs-kueue canceled.

Name Link
🔨 Latest commit 1e72145
🔍 Latest deploy log https://app.netlify.com/projects/kubernetes-sigs-kueue/deploys/69626cc7b22d540008161a09

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

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: andrewseif
Once this PR has been reviewed and has the lgtm label, please assign tenzen-y 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 Jan 8, 2026
@k8s-ci-robot
Copy link
Contributor

Hi @andrewseif. Thanks for your PR.

I'm waiting for a kubernetes-sigs 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 Jan 8, 2026
@mbobrovskyi
Copy link
Contributor

/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. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 9, 2026
@mbobrovskyi
Copy link
Contributor

@andrewseif could you please rebase PR?

}

func ValidateUpdateForWorkloadPriorityClassName(isSuspended bool, oldObj, newObj client.Object) field.ErrorList {
// Cannot ADD a priority class to a NON-suspended (running) workload && wpc is empty
Copy link
Contributor

Choose a reason for hiding this comment

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

If we want to support adding a priority class, I think we should allow it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

as far as I understand the issue mentioned suspended workloads, this piece of code is only affecting running on.

If we change this if condition, it means we allow priority change to running workloads (if I get the code right?)

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I see, you right, we want to fix only suspended workloads.

@andrewseif andrewseif force-pushed the add-wpc-to-suspended-wl branch from fa60457 to f719eea Compare January 9, 2026 08:05
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 9, 2026
oldName := workload.PriorityClassName(old)
newName := workload.PriorityClassName(new)

return newName != "" && oldName != newName
Copy link
Contributor

Choose a reason for hiding this comment

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

You are checking only name here. What about priority?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in this code block we check that the new wl has a wpc

if !workload.IsWorkloadPriorityClass(new) { return false }
and that's what we care about since we want to allow none wpc -> some wpc

return true
}
// Check if priority value changed (for WorkloadPriorityClass value updates).
return priority.Priority(old) != priority.Priority(new)
Copy link
Contributor

Choose a reason for hiding this comment

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

What about this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is more restrictive? its checking (as far as I understand) the priority itself (low or high...etc), but I don't think it would work in a none ->some scenario?

in my case we are checking if old not equal new, and if new isn't empty. so no (some -> none scenario).

Copy link
Contributor

Choose a reason for hiding this comment

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

Please don't remove this logic.

Copy link
Contributor Author

@andrewseif andrewseif Jan 9, 2026

Choose a reason for hiding this comment

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

I reverted the changes to this logic, but removed the culprit which is checking old prio, please check and tell me if that's ok now 😄

@andrewseif andrewseif force-pushed the add-wpc-to-suspended-wl branch from bd900af to ca335de Compare January 10, 2026 12:19
Comment on lines 999 to 1002
// Check that old wl priority class is of type kueue.WorkloadPriorityClass.
if workload.IsPodPriorityClass(old) {
return false
}
Copy link
Contributor

Choose a reason for hiding this comment

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

So now this no need, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

for one sec, I thought that your suggestion removed it, my bad, fixed

Obj(),
wantChanged: false,
},
"PodPriorityClass added (none -> some) - should not trigger": {
Copy link
Contributor

Choose a reason for hiding this comment

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

It would also be great to add a test case where we change the priority value. It should work only for WorkloadPriorityClass.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this got me thinking, is there a case where Kind changed from PodPriority to WorkloadPriority but uses same name? do we need to cover that?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, it would be great to cover this case as well.

Co-authored-by: Mykhailo Bobrovskyi <[email protected]>
util.MustCreate(ctx, k8sClient, normalWl)
util.ExpectWorkloadsToHaveQuotaReservation(ctx, k8sClient, cq.Name, normalWl)

ginkgo.By("Creating a suspended workload WITHOUT priority class")
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 you mean deactivated workload, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add test case here instead? And also apply case from issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think you mean deactivated workload, right?

if I am guessing correctly, in this context you mean:
if I am using .spec.active = true it means deactivated.
if I am using .spec.suspended = true it means suspended?

if so then its deactivated.

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/bug Categorizes issue or PR as related to a bug. 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.

Adding a priority class to a workload (none -> some) is not reconciled

3 participants