-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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-admission-controller: Improve finding the matching VPA for Pod #7010
base: master
Are you sure you want to change the base?
vpa-admission-controller: Improve finding the matching VPA for Pod #7010
Conversation
Skipping CI for Draft Pull Request. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: ialidzhikov 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 |
e529242
to
9fe3a2b
Compare
9fe3a2b
to
4bd7ae0
Compare
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.
Thanks for opening the PR! Just one small comment on my side.
vertical-pod-autoscaler/pkg/admission-controller/resource/vpa/matcher.go
Show resolved
Hide resolved
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.
Thanks for adding the logs, just some very minor nits.
What type of PR is this?
/kind bug
What this PR does / why we need it:
As outlined in #6925, right now the logic in the vpa-admission-controller to find the matching VPA for a Pod is expensive/ineffective. In a summary, no matter the given Pod is scaled by VPA or not, the vpa-admission-controller gets all VPAs in the namespace and fetches the selector for every VPA. Fetching the selector for a VPA is an expensive operation when the VPA's targetRef is a custom resource. For such cases, the
/scale
subresource is being fetched. Note that the usedselectorFetcher
does not have a cache client-side and it always does a GET request for the/scale
subresource:autoscaler/vertical-pod-autoscaler/pkg/target/fetcher.go
Line 130 in c79bdaf
This PR improves the effectiveness of the operations by using the following steps.
/scale
subresource for VPAs which targetRef is matching the parent controllerIn this way the selector would be fetched only for VPAs that match the Pod's parent controller. Previously it was fetched always for all VPAs in the namespace.
In
GetControllingVPAForPod
func it was always fetching the parent controller for a Pod, hence we are not introducing a change by fetching always the Pod's parent controller at the beginning of theGetMatchingVPA
func.Which issue(s) this PR fixes:
N/A
but a result of the following issues #6925, #6884
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: