Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[StatefulSet] Allow to change replicas without queue-name. #3991

Conversation

mbobrovskyi
Copy link
Contributor

@mbobrovskyi mbobrovskyi commented Jan 17, 2025

What type of PR is this?

/kind bug

What this PR does / why we need it:

Allow to change replicas in StatefulSet without queue-name.

Which issue(s) this PR fixes:

Fixes #3996

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Fix the bug that prevented scaling StatefulSets which aren't managed by Kueue when the "statefulset" integration is enabled.

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jan 17, 2025
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jan 17, 2025
Copy link

netlify bot commented Jan 17, 2025

Deploy Preview for kubernetes-sigs-kueue canceled.

Name Link
🔨 Latest commit 7caaf22
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-kueue/deploys/678a4b817bd883000808e87f

@mbobrovskyi
Copy link
Contributor Author

/cc @mimowo

@k8s-ci-robot k8s-ci-robot requested a review from mimowo January 17, 2025 02:01
@mimowo
Copy link
Contributor

mimowo commented Jan 17, 2025

/hold
I need to first understand and align why we make this change. I see this needed for lws, but I expect we can instead make the skip decision based on the owner reference as we do already in other places.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 17, 2025
@mimowo
Copy link
Contributor

mimowo commented Jan 17, 2025

Also the current release note I think is not penetrable for users. It says what the code does but it does not say why a user would need to or what problem it solves from user perspective. At least I'm puzzled by what is the user observable issue.

@mbobrovskyi
Copy link
Contributor Author

/close

@k8s-ci-robot
Copy link
Contributor

@mbobrovskyi: Closed this PR.

In response to this:

/close

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.

@mimowo
Copy link
Contributor

mimowo commented Jan 17, 2025

/reopen
Could you please @mbobrovskyi continue on the PR? I think it fixes a very important issue for 0.10: #3996. Let me review the code details as I now understand the problem.

@k8s-ci-robot k8s-ci-robot reopened this Jan 17, 2025
@k8s-ci-robot
Copy link
Contributor

@mimowo: Reopened this PR.

In response to this:

/reopen
Could you please @mbobrovskyi continue on the PR? I think it fixes a very important issue for 0.10: #3996. Let me review the code details as I now understand the purpose.

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.

replicasPath,
)...)
}
if newQueueName != "" {
Copy link
Contributor

@mimowo mimowo Jan 17, 2025

Choose a reason for hiding this comment

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

This covers 90% of cases. However, ideally, even if the StatefulSet has queue-name, but the owner is already managed by Kueue, then we don't do the validation.

It is more of a corner case, but this could matter for the LWS integration or AppWrapper.

Since this is a corner case I'm on a fence. I'm ok to merge as is, but maybe try to add the check @mbobrovskyi ?

Here is the code where we also look at the owner:

// Do not default suspend a job whose owner is already managed by Kueue
if owner := metav1.GetControllerOf(jobObj); owner != nil && IsOwnerManagedByKueue(owner) {
return false, nil
}
// Jobs with queue names whose parents are not managed by Kueue are default suspended
if QueueNameForObject(jobObj) != "" {
return true, nil
}
. I think it would be great to have the check consistent, unfortunetly not sure we can call this function easily.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we introduce a helper function isManagedByKueue, and do both checks?

if parent managed by Kueue then 
 return false
else if hasQueueName
  return true
 return false

@mimowo
Copy link
Contributor

mimowo commented Jan 17, 2025

Also the current release note I think is not penetrable for users. It says what the code does but it does not say why a user > would need to or what problem it solves from user perspective. At least I'm puzzled by what is the user observable issue.

Sorry for the comment, in retrospect, I think the release note is good. Maybe we can just slightly tweak it:

Fix the bug that prevented scaling StatefulSets which aren't managed by Kueue when the "statefulset" integration is enabled.

@mimowo
Copy link
Contributor

mimowo commented Jan 17, 2025

/hold cancel
I have a good grasp of the issue now. I think the only remaining remark is how to formulate the check. My proposal would be to first exclude StatefulSets which are owned by another CRD managed by Kueue as in the comment, but I think this is not a blocking scenario here.

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 17, 2025
@mbobrovskyi mbobrovskyi force-pushed the fix/allow-to-change-replicas-without-queue-name branch from c5c4816 to 4c08c7b Compare January 17, 2025 12:19
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 17, 2025
@mbobrovskyi mbobrovskyi force-pushed the fix/allow-to-change-replicas-without-queue-name branch from 4c08c7b to 4f28c50 Compare January 17, 2025 12:20
@mbobrovskyi mbobrovskyi force-pushed the fix/allow-to-change-replicas-without-queue-name branch from 4f28c50 to 7caaf22 Compare January 17, 2025 12:22
@mimowo
Copy link
Contributor

mimowo commented Jan 17, 2025

/lgtm
/approve
I tested manually e2e and it solves #3996. Thanks!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 17, 2025
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 260200ab3eb9b81a741abd864823b96c1d196e33

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mbobrovskyi, mimowo

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

The pull request process is described here

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 approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 17, 2025
@mimowo
Copy link
Contributor

mimowo commented Jan 17, 2025

/cherry-pick release-0.10 release-0.9

@k8s-infra-cherrypick-robot
Copy link
Contributor

@mimowo: once the present PR merges, I will cherry-pick it on top of release-0.10 in a new PR and assign it to you.

In response to this:

/cherry-pick release-0.10 release-0.9

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 merged commit dc3d9bd into kubernetes-sigs:main Jan 17, 2025
17 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v0.11 milestone Jan 17, 2025
@k8s-infra-cherrypick-robot
Copy link
Contributor

@mimowo: new pull request created: #3997

In response to this:

/cherry-pick release-0.10 release-0.9

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.

@mimowo
Copy link
Contributor

mimowo commented Jan 17, 2025

/release-note-edit

Fix the bug that prevented scaling StatefulSets which aren't managed by Kueue when the "statefulset" integration is enabled.

@mbobrovskyi mbobrovskyi deleted the fix/allow-to-change-replicas-without-queue-name branch January 17, 2025 13:27
k8s-ci-robot pushed a commit that referenced this pull request Jan 17, 2025
…s without queue-name. (#3998)

* Allow to change replicas without queue-name.

* Allow to change replicas when owner managed by Kueue.

* Skip test cases that requires AppWrapper.
k8s-ci-robot pushed a commit that referenced this pull request Jan 17, 2025
…s without queue-name. (#3999)

* Allow to change replicas without queue-name.

* Allow to change replicas when owner managed by Kueue.
FillZpp pushed a commit to leptonai/kueue that referenced this pull request Feb 5, 2025
…s-sigs#3991)

* [StatefulSet] Allow to change replicas without queue-name.

* Allow to change replicas when owner managed by Kueue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. 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.

Kueue prevents scaling StatefulSets which aren't managed by Kueue
4 participants