-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Apply CPU startup boost in admission controller if its set #8458
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
Apply CPU startup boost in admission controller if its set #8458
Conversation
Hi @kamarabbas99. 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. |
/cc laoj2 |
/ok-to-test |
@adrianmoisey yes I plan to rebase this once that PR is merged! |
aa176bc
to
98da2cc
Compare
98da2cc
to
ae29331
Compare
vertical-pod-autoscaler/pkg/admission-controller/resource/pod/patch/resource_updates.go
Outdated
Show resolved
Hide resolved
vertical-pod-autoscaler/pkg/admission-controller/resource/pod/patch/resource_updates.go
Outdated
Show resolved
Hide resolved
I haven't gone over this in detail yet, just left some nits |
ae29331
to
84a2832
Compare
cd87fa8
to
d0713f2
Compare
updatesAnnotation := []string{} | ||
for i, containerResources := range containersResources { | ||
// Apply startup boost if configured | ||
if features.Enabled(features.CPUStartupBoost) { |
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 block is quite nested and complex. I'd prefer splitting it into smaller functions that reduce the cognitive complexity (less nesting) a little bit. Would make things easier to argue about.
f1fb13c
to
9f96f8f
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.
I need to go over the code again, but these are my initial comments
vertical-pod-autoscaler/pkg/admission-controller/resource/pod/patch/resource_updates.go
Outdated
Show resolved
Hide resolved
// Apply CPU Requests | ||
if containerResources.Requests == nil { | ||
containerResources.Requests = core.ResourceList{} | ||
} | ||
resourceList := core.ResourceList{core.ResourceCPU: *boostedRequest} | ||
if controlledValues == vpa_types.ContainerControlledValuesRequestsOnly { | ||
vpa_api_util.CapRecommendationToContainerLimit(resourceList, container.Resources.Limits) | ||
} | ||
containerResources.Requests[core.ResourceCPU] = resourceList[core.ResourceCPU] |
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.
Don't we need to check here the cpu is part of the controlledResources
of the vpa object?
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.
According to KEP, startupboost field takes priority over that.
https://github.com/kubernetes/autoscaler/tree/master/vertical-pod-autoscaler/enhancements/7862-cpu-startup-boost#priority-of-startupboost
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.
Got it. thanks!
a348031
to
27cca7d
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.
It's looking good, I have a few comments
vertical-pod-autoscaler/pkg/admission-controller/resource/pod/patch/resource_updates.go
Outdated
Show resolved
Hide resolved
vertical-pod-autoscaler/pkg/admission-controller/resource/pod/patch/resource_updates_test.go
Outdated
Show resolved
Hide resolved
vertical-pod-autoscaler/pkg/admission-controller/resource/pod/patch/resource_updates_test.go
Outdated
Show resolved
Hide resolved
27cca7d
to
cef6b83
Compare
cef6b83
to
4b19257
Compare
/release-note-edit
|
I'm good with this |
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! tested it and it worked ( there is one bug in the admission controller unrelated to that - will open an issue ).
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: kamarabbas99, omerap12 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 |
a3ce8e2
into
kubernetes:experimental-cpu-boost
For people intests: NAME MODE CPU MEM PROVIDED AGE
example-vpa Auto 25m 250Mi True 5m43s And if we take a look into a pod: kind: Pod
metadata:
annotations:
startup-cpu-boost: '{"requests":{"cpu":"250m","memory":"100Mi"},"limits":{"cpu":"500m","memory":"200Mi"}}' With: resources:
limits:
cpu: 150m
memory: 500Mi
requests:
cpu: 75m
memory: 250Mi VPA configured as follows: startupBoost:
cpu:
type: "Factor"
factor: 3
duration: 10s |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Which issue(s) this PR fixes:
Introduces changes in the admission-controller component to apply cpu startup boost if its set in the vpa spec.
Also the original cpu request is added in annotation to verify if the updater correctly reverts back to original state.
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: