-
Notifications
You must be signed in to change notification settings - Fork 4.3k
VPA: (InPlaceOrRecreate) Allow updater to actuate InPlaceOrRecreate updates #7962
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
VPA: (InPlaceOrRecreate) Allow updater to actuate InPlaceOrRecreate updates #7962
Conversation
|
/hold |
|
/test pull-kubernetes-e2e-autoscaling-vpa-full |
vertical-pod-autoscaler/pkg/updater/eviction/pods_eviction_restriction.go
Outdated
Show resolved
Hide resolved
vertical-pod-autoscaler/pkg/updater/eviction/pods_eviction_restriction.go
Outdated
Show resolved
Hide resolved
6dd33cc to
7f9b9c4
Compare
|
FYI:
Verify tests are failing b/c I rebased on the admission PR, which had the same issue which I fixed, but I didn't fix the issue in this PR. Once that's merged, I'll rebase again. |
We might want to add a few more that are combined disruption counters, e.g. in-place + eviction totals, but for now just add some separate counters to keep track of what in-place updates are doing.
7f9b9c4 to
114091d
Compare
raywainman
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First pass through. Need to do another pass but thought I'd shoot off some questions to start.
Lots of great work here, thanks a lot @maxcao13!
vertical-pod-autoscaler/pkg/updater/eviction/pods_eviction_restriction.go
Outdated
Show resolved
Hide resolved
vertical-pod-autoscaler/pkg/updater/eviction/pods_eviction_restriction.go
Outdated
Show resolved
Hide resolved
vertical-pod-autoscaler/pkg/updater/eviction/pods_eviction_restriction.go
Outdated
Show resolved
Hide resolved
vertical-pod-autoscaler/pkg/updater/eviction/pods_eviction_restriction.go
Outdated
Show resolved
Hide resolved
vertical-pod-autoscaler/pkg/updater/eviction/pods_eviction_restriction.go
Outdated
Show resolved
Hide resolved
vertical-pod-autoscaler/pkg/updater/eviction/pods_eviction_restriction.go
Outdated
Show resolved
Hide resolved
114091d to
93a37e4
Compare
vertical-pod-autoscaler/pkg/updater/eviction/pods_eviction_restriction.go
Outdated
Show resolved
Hide resolved
vertical-pod-autoscaler/pkg/updater/eviction/pods_eviction_restriction.go
Outdated
Show resolved
Hide resolved
vertical-pod-autoscaler/pkg/updater/eviction/pods_eviction_restriction.go
Outdated
Show resolved
Hide resolved
vertical-pod-autoscaler/pkg/updater/eviction/pods_eviction_restriction.go
Outdated
Show resolved
Hide resolved
e6356b6 to
5a3f674
Compare
|
I refactored a lot of the in-place stuff out of the eviction code and separated them in 5a3f674. I need to write more unit tests for the inplaceRestriction stuff but wanted to push this for now for review. |
9818035 to
34d1df0
Compare
|
Sorry if it looks like the latest change was big, a lot of the changes were moving things around, renaming, lowercasing some fields, and adding/fixing unit tests. Other than that, I've refactored the tolerance code a bit to address @raywainman's comments, and changed it so that I've added some unit tests to confirm the functionality. Reviewers, please take a look when you can. This diff is the list of changes since the last commit to now if that helps: https://github.com/kubernetes/autoscaler/compare/93a37e47308ad58275e909bfeaa0347b2ef6b4ba..34d1df06b3b84611e888dbbf988741bb1f3744dd |
raywainman
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking really good. Generally just some nits. Thanks Max!
vertical-pod-autoscaler/pkg/admission-controller/resource/pod/patch/calculator.go
Outdated
Show resolved
Hide resolved
vertical-pod-autoscaler/pkg/admission-controller/resource/pod/patch/calculator.go
Outdated
Show resolved
Hide resolved
vertical-pod-autoscaler/pkg/admission-controller/resource/pod/patch/resource_updates.go
Outdated
Show resolved
Hide resolved
vertical-pod-autoscaler/pkg/utils/annotations/vpa_inplace_update.go
Outdated
Show resolved
Hide resolved
vertical-pod-autoscaler/pkg/updater/restriction/pods_inplace_restriction.go
Outdated
Show resolved
Hide resolved
vertical-pod-autoscaler/pkg/updater/inplace/inplace_recommendation_provider.go
Outdated
Show resolved
Hide resolved
Introduces large changes in the updater component to allow InPlaceOrRecreate mode. If the feature gate is enabled and the VPA update mode is InPlaceOrRecreate, the updater will attempt an in place update by first checking a number of preconditions before actuation (e.g., if the pod's qosClass would be changed, whether we are already in-place resizing, whether an in-place update may potentially violate disruption(previously eviction) tolerance, etc.). After the preconditions are validated, we send an update signal to the InPlacePodVerticalScaling API with the recommendation, which may or may not fail. Failures are handled in subsequent updater loops. As for implementation details, patchCalculators have been re-used from the admission-controllers code for the updater in order to calculate recommendations for the updater to actuate. InPlace logic has been mostly stuffed in the eviction package for now because of similarities and ease (user-initated API calls eviction vs. in-place; both cause disruption). It may or may not be useful to refactor this later. Signed-off-by: Max Cao <[email protected]>
Signed-off-by: Max Cao <[email protected]>
The script needs to also check if the yaml input is a Deployment, and no longer needs to check for vpa-component names. Signed-off-by: Max Cao <[email protected]>
Signed-off-by: Max Cao <[email protected]>
This commit refactors inplace logic outside of the pods eviction restriction and separates them into their own files. Also this commit adds PatchResourceTarget to calculators to allow them to explictly specify to the caller which resource/subresource they should be patched to. This commit also creates a utils subpackage in order to prevent dependency cycles in the unit tests, and adds various unit tests. Lastly, this commit adds a rateLimiter specifically for limiting inPlaceResize API calls. Signed-off-by: Max Cao <[email protected]>
0cbc46a to
ed9358c
Compare
|
Overall LGTM. I would LOVE a second pair of eyes on this just given there is a lot happening here. @adrianmoisey, @omerap12, @voelzmo any chance I could get a second look? Thanks a lot Max for patiently dealing with my waves of comments :) |
vertical-pod-autoscaler/pkg/updater/restriction/pods_restriction_factory.go
Outdated
Show resolved
Hide resolved
omerap12
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are just my initial thoughts—planning to do another pass later.
vertical-pod-autoscaler/pkg/updater/restriction/pods_inplace_restriction.go
Show resolved
Hide resolved
Signed-off-by: Max Cao <[email protected]>
|
Is there anything else that needs to be addressed here? |
|
lgtm, thank you! Excellent work, Max :) |
|
Nope, I'll put that PR up now thanks Omer! (and it should be the last one before the big PR to main) |
Great, Thanks! |
|
PR is here: #8072 |
|
I know there are still some outstanding TODOs here but in the interest of unblocking this I think this is OK to go now. We can iterate from here. Really great work @maxcao13, thanks again. /lgtm /approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: maxcao13, raywainman The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Introduces large changes in the updater component to allow
InPlaceOrRecreatemode. If the feature gate is enabled and the VPA update mode isInPlaceOrRecreate, the updater will attempt an in place update by first checking a number of preconditions before actuation (e.g., whether we are already in-place resizing,whether an in-place update may potentially violate disruption(previously eviction) tolerance, etc.). After the preconditions are validated, we send an update signal to the
InPlacePodVerticalScalingAPI with the recommendation, which may or may not fail. Failures are handled in subsequent updater loops.We need this in order to actually actuate in place updates.
Which issue(s) this PR fixes:
Part of AEP-4016 (InPlaceVerticalScaling/InPlaceOrRecreate)
This PR is part of the larger feature PR in #7673
Depends on:
Note that this PR is merging into the in-place-updates feature branch, which will be merged when this feature is all reviewed and ready.
Special notes for your reviewer:
As for implementation details,
patchCalculatorshave been re-used from the admission-controllers code for the updater in order to calculate recommendations for the updater to actuate. InPlace logic has been mostly stuffed in the eviction package for now because of similarities and ease (user-initated API calls eviction vs. in-place; both cause disruption), maybe we also need a "disruption limiter". It may or may not be useful to refactor this later.There are some TODOs littered throughout the code. I've limited as many TODOS as possible, but I'm using the rest of the TODOs as review markers to draw attention to parts of the discussion that need community discussion. Otherwise, they are items that should be fixed after 1.33 1287 KEP changes are released, or other future work.
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: