-
Notifications
You must be signed in to change notification settings - Fork 4k
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
[WIP] VPA: Implement in-place updates support #7673
base: master
Are you sure you want to change the base?
Conversation
Hi @maxcao13. 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 Once the patch is verified, the new status will be reflected by the 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. |
This PR may require API review. If so, when the changes are ready, complete the pre-review checklist and request an API review. Status of requested reviews is tracked in the API Review project. |
/ok-to-test |
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.
This is just my first review after going through all the changes. I will go over it multiple times, but these are my initial comments for now.
vertical-pod-autoscaler/pkg/utils/annotations/vpa_inplace_update.go
Outdated
Show resolved
Hide resolved
vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1/types.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
Show resolved
Hide resolved
vertical-pod-autoscaler/pkg/updater/priority/update_priority_calculator.go
Outdated
Show resolved
Hide resolved
vertical-pod-autoscaler/pkg/updater/priority/update_priority_calculator.go
Outdated
Show resolved
Hide resolved
vertical-pod-autoscaler/pkg/updater/priority/update_priority_calculator.go
Outdated
Show resolved
Hide resolved
vertical-pod-autoscaler/pkg/updater/priority/update_priority_calculator.go
Outdated
Show resolved
Hide resolved
vertical-pod-autoscaler/pkg/updater/priority/update_priority_calculator.go
Outdated
Show resolved
Hide resolved
6ea7337
to
53d4006
Compare
Appreciate the review! I will respond to the other comments tomorrow, just wanted to get the easy stuff out of the way and less cluttered. |
Sure, take your time |
vertical-pod-autoscaler/pkg/updater/eviction/pods_eviction_restriction.go
Outdated
Show resolved
Hide resolved
This is an important note/question. It may just be me being confused about the AEP details, but AFAIK there is no way for a user to guarantee that a resize request will be disruptonless. We can only guarantee that a resize will be disruptful (by configuring container resize restart policy). So how can we dictate the resizing type based on the conditions in the AEP? e.g. in the AEP it states
Since the conditions are different, how can we actually make sure the first set of actions will actually be disruption free? I think this problem requires the need for a third resizePolicy |
This will be affected by KEP-1287 update in 1.33: kubernetes/enhancements#5089
|
This just addes the UpdateModeInPlaceOrRecreate mode to the types so we can use it. I did not add InPlaceOnly, as that seemed contentious and it didn't seem like we had a good use case for it yet.
Signed-off-by: Max Cao <[email protected]>
So because of InPlacePodVerticalScaling, we can have a pod object whose resource spec is correct, but whose status is not, because that pod may have been updated in-place after the original admission. This would have been ignored until now because "the spec looks correct", but we need to take the status into account as well if a resize is in progress. This commit: - takes status resources into account for pods/containers that are being in-place resized - makes sure that any pods that are "stuck" in-place updating (i.e. the node doesn't have enough resources either temporarily or permanently) will still show up in the list as having "wrong" resources so they can still get queued for eviction and be re-assigned to nodes that do have enough resources
This commit makes the eviction restrictor in-place update aware. While this possibly could be a separate restrictor or refactored into a shared "disruption restrictor", I chose not to do that at this time. I don't think eviction/in-place update can be completely separate as they can both cause disruption (albeit in-place less so) -- they both need to factor in the total disruption -- so I just hacked the in-place update functions into the existing evictor and added some additional counters for disruption tracking. While we have the pod lifecycle to look at to figure out "where we are" in eviction, we don't have that luxury with in-place, so that's why we need the additional "IsInPlaceUpdating" helper.
The updater logic wasn't in-place aware, so I tried to make it so. The thought here is that we try to in-place update if we can, if we can't or if it gets stuck/can't satisfy the recommendation, then we fall back to eviction. I tried to keep the "blast radius" small by stuffing the in-place logic in its own function and then falling back to eviction if it's not possible. It would be nice if we had some sort of "can the node support an in-place resize with the current recommendation" but that seemed like a whole other can of worms and math.
2fa0144
to
e739fd9
Compare
const ( | ||
// VpaInPlaceUpdatedLabel is a label used by the vpa inplace updated annotation. | ||
VpaInPlaceUpdatedLabel = "vpaInPlaceUpdated" | ||
) |
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.
Is this a label or an annotation?
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.
I copied the style from here:
autoscaler/vertical-pod-autoscaler/pkg/utils/annotations/vpa_observed_containers.go
Line 29 in 54fe60e
VpaObservedContainersLabel = "vpaObservedContainers" |
label
since it was written 6 years ago, but it probably makes more sense to be VpaInPlaceUpdatedAnnotationKey
or something.
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.
There are quite a few TODO comments. Is this PR ready for merge?
For now: You can change the title once this is ready to merge @maxcao13 |
e739fd9
to
b66e87d
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: maxcao13 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 |
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.
For now, this just updates the mock with the new functions I added to the eviction interface. We need some in-place test cases.
TODO(jkyros): come back here and look at this after you get it working
So far this is just: - Make sure it scales when it can But we still need a bunch of other ones like - Test fallback to eviction - Test timeout/eviction when it gets stuck, etc
0ae50f0
to
753d0a4
Compare
In the event that we can't perform the whole update, this calculates a set of updates that should be disruptionless and only queues that partial set, omitting the parts that would cause disruption.
Signed-off-by: Max Cao <[email protected]>
Signed-off-by: Max Cao <[email protected]>
Signed-off-by: Max Cao <[email protected]>
Signed-off-by: Max Cao <[email protected]>
Because of kubernetes#7813, this commit reverts a lot of the changes that introducted logic that involved actuating in-place updates based on the containerResizePolicy. Signed-off-by: Max Cao <[email protected]>
Signed-off-by: Max Cao <[email protected]>
753d0a4
to
50ba1c8
Compare
What type of PR is this?
WIP
Depends on: #7813
/kind feature
/kind api-change
What this PR does / why we need it:
This PR is an attempt to implement VPA in-place vertical scaling according to AEP-4016. It uses the VPA updater to actuate recommendations by sending
resize
patch requests to pods which allows in-place resize as enabled by theInPlacePodVerticalScaling
feature flag in k8s 1.27.0 alpha and above (or by eventual graduation).It includes some e2e tests currently according to the AEP, but I am sure we will probably need more.
This PR is a continuation of #6652 started by @jkyros with a cleaner git commit history.
Which issue(s) this PR fixes:
Fixes #4016
Special notes for your reviewer:
Notable general areas of concern:
See this comment about the potential need for a thirdcontainerResize
policy that currently does not exist in the k8s api.Needs more attention on how disruptive/disruption-free updates (should affect)/(are affected) byPodDisruptionBudgets
.For now, there are many many TODOs literred throughout the code which need attention from reviewers/maintainers. A lot is because of design decisions I probably shouldn't make on my own. I resolved some of John's TODOs but he still has relevant comments that need to be addressed as well. I am using the TODOs as the "special notes for your reviewer" section, if people would like a comment somewhere which lays them all out nicely, I'm more than happy to make one.Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: