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

ignore 0 replica check #439

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

congcongke
Copy link

What type of PR is this?

/kind bug

What this PR does / why we need it

Scale to 0 is not worked when rolling update is enabled. Skip the related check should be considered.

Which issue(s) this PR fixes

Fixes #

Special notes for your reviewer

Does this PR introduce a user-facing change?


Copy link

linux-foundation-easycla bot commented Mar 17, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: congcongke / name: zhanweidu (868a712)

@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Mar 17, 2025
@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Mar 17, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @congcongke. 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.

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 needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Mar 17, 2025
Copy link

netlify bot commented Mar 17, 2025

Deploy Preview for kubernetes-sigs-lws canceled.

Name Link
🔨 Latest commit 868a712
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-lws/deploys/67dc2808d6d38300085eb6e3

@yankay
Copy link
Member

yankay commented Mar 17, 2025

/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 Mar 17, 2025
@@ -165,7 +165,7 @@ func (r *LeaderWorkerSetWebhook) generalValidate(obj runtime.Object) field.Error
if err != nil {
allErrs = append(allErrs, field.Invalid(maxSurgePath, maxSurge, "invalid value"))
}
if maxUnavailableValue == 0 && maxSurgeValue == 0 {
if maxUnavailableValue == 0 && maxSurgeValue == 0 && *lws.Spec.Replicas != 0 {
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 it's not related between the scaling-to-zero and rolling update configuration. What you mean here is once replicas == 0, the maxUnavailable and maxSurgeValue could both be zero, however, it's not.

Copy link
Author

Choose a reason for hiding this comment

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

https://github.com/kubernetes-sigs/lws/blob/da1267b252e17fe795cbc41249a43eb9d52cbca5/pkg/webhooks/leaderworkerset_webhook.go#L160C37-L160C67

Let's consider the case: replica = 0, maxUnavailable = 25% and maxSurge = 20%.
Then maxUnavailableValue will be 0 and maxSurge will be 0 as the calculated as above. Then admission webhook forbid this operation.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, I forgot the value is calculated from the replicas. Let's add a webhook test to make sure it works with replicas==0.

@Edwinhr716
Copy link
Contributor

/lgtm
This makes sense to me, will leave to @kerthcet for approval. Can you do the EasyCLA authorization @congcongke?

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

/lgtm This makes sense to me, will leave to @kerthcet for approval. Can you do the EasyCLA authorization @congcongke?

I tried to authorized the app. It failed always.

By the way, I think you can make a same change and close this one.

@kerthcet
Copy link
Contributor

Hi @congcongke I can help you with this if you want to contribute this PR. Maybe you can follow the doc: https://github.com/kubernetes/community/blob/master/CLA.md

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Mar 18, 2025
@congcongke
Copy link
Author

Hi @congcongke I can help you with this if you want to contribute this PR. Maybe you can follow the doc: https://github.com/kubernetes/community/blob/master/CLA.md

Yeah, thank you so much!

@kerthcet
Copy link
Contributor

Could you add a test? #439 (comment)

Signed-off-by: zhanweidu <[email protected]>
@k8s-ci-robot
Copy link
Contributor

New changes are detected. LGTM label has been removed.

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

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

The full list of commands accepted by this bot can be found 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 size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Mar 20, 2025
@congcongke
Copy link
Author

Could you add a test? #439 (comment)

Sorry, forgot it.

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. 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.

5 participants