autoscaler icon indicating copy to clipboard operation
autoscaler copied to clipboard

Implement KEP-4831: Control VPA eviction behavior based on scaling direction and resource

Open voelzmo opened this issue 1 year ago • 4 comments

Which component this PR applies to?

vertical-pod-autoscaler

What type of PR is this?

/kind feature /kind api-change

What this PR does / why we need it

Implements KEP-4831: Control VPA eviction behavior based on scaling direction and resource

Which issue(s) this PR fixes:

Implements #4831

Special notes for your reviewer:

Does this PR introduce a user-facing change?


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


voelzmo avatar Sep 08 '22 12:09 voelzmo

While looking for the best place to put this into the Updater, I found https://github.com/kubernetes/autoscaler/blob/master/vertical-pod-autoscaler/pkg/updater/priority/pod_eviction_admission.go which was pulled in years ago with https://github.com/kubernetes/autoscaler/pull/1002 but apparently never used afterwards. Beata (after merging) even commented that the default implementation isn't even used: https://github.com/kubernetes/autoscaler/pull/1002#pullrequestreview-130869322

I guess this is probably a good place to implement the filtering we want to do based on the comparison of target and requests and if no restrictions are given, just use the already implemented noopPodEvictionAdmission?

There's also https://github.com/kubernetes/autoscaler/blob/master/vertical-pod-autoscaler/pkg/updater/eviction/pods_eviction_restriction.go but that seems to be concerned with limiting eviction based on minimum available replicas and ensuring this also works for Jobs and other Pod owners in the same way.

@jbartosik WDYT, should I just make use of the PodEvictionAdmission linked above? From a flow perspective, this seems to be a good fit, as it is used in the priority calculator, where Pod requests and target recommendation are compared to figure out if a Pod should be evicted and in which order.

voelzmo avatar Sep 08 '22 12:09 voelzmo

While looking for the best place to put this into the Updater, I found https://github.com/kubernetes/autoscaler/blob/master/vertical-pod-autoscaler/pkg/updater/priority/pod_eviction_admission.go which was pulled in years ago with #1002 but apparently never used afterwards. Beata (after merging) even commented that the default implementation isn't even used: #1002 (review)

I guess this is probably a good place to implement the filtering we want to do based on the comparison of target and requests and if no restrictions are given, just use the already implemented noopPodEvictionAdmission?

Yes, adding a new type that implements PodEvictionAdmission and passing it to Updater seems to be the best way to implement this KEP.

I'd implement it so when there are no restrictions it just allows the pod

jbartosik avatar Sep 26 '22 12:09 jbartosik

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: voelzmo Once this PR has been reviewed and has the lgtm label, please assign kgolab for approval by writing /assign @kgolab in a comment. 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

k8s-ci-robot avatar Nov 03 '22 12:11 k8s-ci-robot

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.

k8s-triage-robot avatar Jan 25 '23 14:01 k8s-triage-robot

@jbartosik I've added an implementation PR using this API in #5599, so this API change is good to be reviewed from my side. Can you please take a look? Thanks!

voelzmo avatar Mar 15 '23 12:03 voelzmo

@jbartosik Can you please take a look? Thanks!

voelzmo avatar Apr 19 '23 08:04 voelzmo

@jbartosik Can you try to give this a review, please? Thanks!

voelzmo avatar May 03 '23 08:05 voelzmo

Let's decide if we want to change the API for in-place updates before merging this (https://github.com/kubernetes/autoscaler/pull/5754)

jbartosik avatar May 18 '23 12:05 jbartosik

Force-pushed an update:

  • rebased on current master
  • removed the OrEqual ChangeRequirements as discussed in https://github.com/kubernetes/autoscaler/pull/5754#issuecomment-1647577540

voelzmo avatar Jul 25 '23 12:07 voelzmo

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mwielgus, voelzmo

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 avatar Aug 07 '23 20:08 k8s-ci-robot