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

API for KEP-4831: Control VPA eviction behavior based on scaling direction and resource #5176

Merged

Conversation

voelzmo
Copy link
Contributor

@voelzmo voelzmo commented Sep 8, 2022

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:

API for #4831
Implementation is done in #5599

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 do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/feature Categorizes issue or PR as related to a new feature. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 8, 2022
@voelzmo
Copy link
Contributor Author

voelzmo commented Sep 8, 2022

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?

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.

@jbartosik
Copy link
Collaborator

jbartosik commented Sep 26, 2022

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

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 29, 2022
@voelzmo voelzmo force-pushed the enh/add-eviction-requirements branch from f15116a to 46cd18d Compare November 3, 2022 13:34
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 3, 2022
@voelzmo voelzmo force-pushed the enh/add-eviction-requirements branch from 46cd18d to 74efdb1 Compare January 25, 2023 14:10
@voelzmo voelzmo marked this pull request as ready for review January 25, 2023 14:10
@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 Jan 25, 2023
@voelzmo voelzmo changed the title Implement KEP-4831: Control VPA eviction behavior based on scaling direction and resource Implement API for KEP-4831: Control VPA eviction behavior based on scaling direction and resource Jan 25, 2023
@k8s-ci-robot k8s-ci-robot requested a review from kgolab January 25, 2023 14:11
@k8s-triage-robot
Copy link

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.

@voelzmo voelzmo force-pushed the enh/add-eviction-requirements branch from 74efdb1 to e65bdc4 Compare January 26, 2023 09:51
@voelzmo voelzmo force-pushed the enh/add-eviction-requirements branch from e65bdc4 to 7fee719 Compare March 15, 2023 09:31
@voelzmo voelzmo changed the title Implement API for KEP-4831: Control VPA eviction behavior based on scaling direction and resource API for KEP-4831: Control VPA eviction behavior based on scaling direction and resource Mar 15, 2023
@voelzmo
Copy link
Contributor Author

voelzmo commented Mar 15, 2023

@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
Copy link
Contributor Author

voelzmo commented Apr 19, 2023

@jbartosik Can you please take a look? Thanks!

@voelzmo
Copy link
Contributor Author

voelzmo commented May 3, 2023

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

Copy link
Collaborator

@jbartosik jbartosik left a comment

Choose a reason for hiding this comment

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

Since in-place pod updates are now finally a thing (alpha but I hope for beta soon) I'd like to make sure this works well with support for in place updates.

I can see two approaches:

  • have one "actuationRequirements" that affect both in-place and eviction actuation
  • have separate controls for "evictionRequirements" and "inPlaceUpdateRequirements"

I lean towards single "actuationRequirements" because it's simpler and I don't see how I'd use separate controls for eviction and in place update. What do you think?

@@ -3,7 +3,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
api-approved.kubernetes.io: https://github.com/kubernetes/kubernetes/pull/63797
controller-gen.kubebuilder.io/version: v0.4.0
Copy link
Collaborator

Choose a reason for hiding this comment

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

This looks like #5178; Can you rebase this PR on top of #5178 . It will make review a bit easier

Copy link
Collaborator

Choose a reason for hiding this comment

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

I sent #5754

@jbartosik
Copy link
Collaborator

Let's decide if we want to change the API for in-place updates before merging this (#5754)

@voelzmo voelzmo force-pushed the enh/add-eviction-requirements branch from 7fee719 to 1b35940 Compare July 25, 2023 12:29
@voelzmo
Copy link
Contributor Author

voelzmo commented Jul 25, 2023

Force-pushed an update:

Copy link
Collaborator

@jbartosik jbartosik left a comment

Choose a reason for hiding this comment

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

Looks good to me

@mwielgus @gjtempleton could you take a look please

vertical-pod-autoscaler/deploy/vpa-v1-crd-gen.yaml Outdated Show resolved Hide resolved
Copy link
Contributor

@mwielgus mwielgus left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 7, 2023
@k8s-ci-robot
Copy link
Contributor

[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 k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 7, 2023
@k8s-ci-robot k8s-ci-robot merged commit a3bcd98 into kubernetes:master Aug 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/vertical-pod-autoscaler cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants