Skip to content

(feat: scale) limitranger allow pod update #124887

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

Closed

Conversation

mouuii
Copy link
Contributor

@mouuii mouuii commented May 15, 2024

What type of PR is this?

/kind feature

What this PR does / why we need it:

The LimitRanger admission plugin does not currently handle pod updates, but needs to be updated to account for InPlacePodVerticalScaling:

Which issue(s) this PR fixes:

Fixes #124855

Special notes for your reviewer:

Does this PR introduce a user-facing change?


Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. kind/feature Categorizes issue or PR as related to a new feature. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels May 15, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @mouuii. Thanks for your PR.

I'm waiting for a kubernetes 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. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels May 15, 2024
@mouuii mouuii force-pushed the limit-range-allow-pod-update branch from 84d2679 to afb96b0 Compare May 15, 2024 13:22
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels May 15, 2024
@mouuii
Copy link
Contributor Author

mouuii commented May 15, 2024

/sig node

@k8s-ci-robot k8s-ci-robot added sig/node Categorizes an issue or PR as relevant to SIG Node. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels May 15, 2024
@mouuii
Copy link
Contributor Author

mouuii commented May 15, 2024

/cc tallclair

@k8s-ci-robot k8s-ci-robot requested a review from tallclair May 15, 2024 13:28
@iholder101
Copy link
Contributor

/release-note-none
/ok-to-test

Looks good overall.
Would you mind adding an e2e test?

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 15, 2024
@iholder101
Copy link
Contributor

/cc

@k8s-ci-robot k8s-ci-robot requested a review from iholder101 May 15, 2024 14:54
@mouuii
Copy link
Contributor Author

mouuii commented May 15, 2024

/release-note-none /ok-to-test

Looks good overall. Would you mind adding an e2e test?

I'm not familiar with writing e2e and I think this change will only affect performance ?

@mouuii mouuii changed the title limit range allow pod update limitranger allow pod update May 15, 2024
@ffromani
Copy link
Contributor

should the changes done here be gated by the InPlaceVerticalAutoscaling featuregate, like we do e.g. in the kubelet?

@iholder101
Copy link
Contributor

should the changes done here be gated by the InPlaceVerticalAutoscaling featuregate, like we do e.g. in the kubelet?

Good point. +1

@k8s-ci-robot k8s-ci-robot removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels May 20, 2024
@iholder101
Copy link
Contributor

@mouuii Are you still willing to work on this PR?
If so, I'll be happy to help move this forward. If not, I'll gladly pick it up. Let me know! :)

@mouuii
Copy link
Contributor Author

mouuii commented Sep 8, 2024

@mouuii Are you still willing to work on this PR? If so, I'll be happy to help move this forward. If not, I'll gladly pick it up. Let me know! :)

yes @iholder101

@googs1025
Copy link
Member

@mouuii Are you still willing to work on this PR? If so, I'll be happy to help move this forward. If not, I'll gladly pick it up. Let me know! :)

yes @iholder101

Are you still willing to work on this PR?
If you are not in charge of this work, is it possible for someone else to be involved?
It looks like we need to add e2e tests or integration tests (if needed).
cc @iholder101

@@ -743,8 +743,8 @@ func TestLimitRangerIgnoresSubresource(t *testing.T) {
t.Errorf("Expected an error since the pod did not specify resource limits in its create call")
}
err = handler.Validate(context.TODO(), admission.NewAttributesRecord(&testPod, nil, api.Kind("Pod").WithVersion("version"), limitRange.Namespace, "testPod", api.Resource("pods").WithVersion("version"), "", admission.Update, &metav1.UpdateOptions{}, false, nil), nil)
if err != nil {
t.Errorf("Expected not to call limitranger actions on pod updates")
if err == nil {
Copy link
Member

Choose a reason for hiding this comment

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

why err == nil but print t.Errorf(

Copy link
Member

@googs1025 googs1025 Sep 20, 2024

Choose a reason for hiding this comment

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

Test cases are needed to verify whether the code we modified complies with the logic. It is not just for passing the test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

to allow pod update , previous we do not allow update.
what kind of test cases ? can you show me how to write?
@googs1025

Copy link
Member

Choose a reason for hiding this comment

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

First, you need to modify the unit test code itself, not just to pass the tests.... Second, since you've made changes, you should incrementally cover the logic of your changes to ensure the code's rationality.

Copy link
Member

@googs1025 googs1025 Sep 21, 2024

Choose a reason for hiding this comment

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

If you encounter difficulties during the process, perhaps you could consider handing over this pr to someone else.

Copy link
Member

Choose a reason for hiding this comment

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

@mouuii :)

@k8s-ci-robot k8s-ci-robot added the do-not-merge/contains-merge-commits Indicates a PR which contains merge commits. label Sep 21, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mouuii
Once this PR has been reviewed and has the lgtm label, please assign jpbetz for approval. For more information see the Kubernetes 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

@mouuii
Copy link
Contributor Author

mouuii commented Sep 23, 2024

/restest

@mouuii mouuii changed the title limitranger allow pod update [wip]limitranger allow pod update Sep 24, 2024
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 24, 2024
@mouuii
Copy link
Contributor Author

mouuii commented Sep 24, 2024

/retest

@mouuii mouuii changed the title [wip]limitranger allow pod update limitranger allow pod update Sep 24, 2024
@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 Sep 24, 2024
@mouuii
Copy link
Contributor Author

mouuii commented Sep 24, 2024

/test pull-kubernetes-e2e-gce

@mouuii mouuii force-pushed the limit-range-allow-pod-update branch from 57857f2 to 9ee7511 Compare September 24, 2024 05:22
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/contains-merge-commits Indicates a PR which contains merge commits. label Sep 24, 2024
@mouuii
Copy link
Contributor Author

mouuii commented Sep 24, 2024

/test pull-kubernetes-e2e-gce

@mouuii
Copy link
Contributor Author

mouuii commented Sep 25, 2024

This is ready. PTAL.@iholder101 @tallclair

@googs1025
Copy link
Member

/release-note-none /ok-to-test

Looks good overall. Would you mind adding an e2e test?

According to this comment, we need to add e2e or integration tests to ensure that the changes are reasonable. :)

@mouuii mouuii changed the title limitranger allow pod update (feat: scale) limitranger allow pod update Oct 11, 2024
@tallclair
Copy link
Member

/assign

@AnishShah
Copy link
Contributor

Can we add some e2e tests for this? For eg, we have pod resize e2e tests with ResourceQuota here

// to mutate and validate limitrange on pod updates. Trying to mutate containers or initContainers on a pod
// update request will always fail pod validation because those fields are immutable once the object is created.
if a.GetKind().GroupKind() == api.Kind("Pod") && a.GetOperation() == admission.Update {
if a.GetKind().GroupKind() == api.Kind("Pod") && a.GetOperation() == admission.Update && !feature.DefaultFeatureGate.Enabled(features.InPlacePodVerticalScaling) {
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI, This won't work after #128266 as we add resize subresource to do pod resize.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do we need this logic after using resize subresource ? @AnishShah

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, we still need the logic. But instead of pod update, we need it during resize subresource. I provisionally added the logic in my PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so this pr can close after your pr merged ? and e2e test can be writen in your pr ? @AnishShah

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I added e2e tests in 1b93d0f

@tallclair
Copy link
Member

This fix has been rolled into #128266

/close

@k8s-ci-robot
Copy link
Contributor

@tallclair: Closed this PR.

In response to this:

This fix has been rolled into #128266

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

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. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. release-note-none Denotes a PR that doesn't merit a release note. sig/node Categorizes an issue or PR as relevant to SIG Node. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Development

Successfully merging this pull request may close these issues.

[FG:InPlacePodVerticalScaling] Handle in-place pod resource updates in LimitRanger admission plugin
9 participants