Skip to content

Conversation

kamarabbas99
Copy link
Contributor

@kamarabbas99 kamarabbas99 commented Aug 18, 2025

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?

Users can now configure a startupBoost policy in the VPA spec. 

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

- [KEP]: (https://github.com/kubernetes/autoscaler/tree/master/vertical-pod-autoscaler/enhancements/7862-cpu-startup-boost#aep-7862-cpu-startup-boost)
Apply CPU startup boost in admission controller if its set

@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-area labels Aug 18, 2025
@k8s-ci-robot
Copy link
Contributor

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed do-not-merge/needs-area labels Aug 18, 2025
@kamarabbas99
Copy link
Contributor Author

/cc laoj2

@k8s-ci-robot k8s-ci-robot requested a review from laoj2 August 18, 2025 19:56
@kamarabbas99 kamarabbas99 changed the title Feature cpu ac Apply CPU startup boost in admission controller if its set Aug 18, 2025
@adrianmoisey
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 18, 2025
@adrianmoisey
Copy link
Member

This PR contains similar changes to #8417
I thought the plan was to split up into multiple changes?

Could we get #8417 merged first?

@kamarabbas99
Copy link
Contributor Author

@adrianmoisey yes I plan to rebase this once that PR is merged!

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 24, 2025
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Aug 25, 2025
@adrianmoisey
Copy link
Member

I haven't gone over this in detail yet, just left some nits

updatesAnnotation := []string{}
for i, containerResources := range containersResources {
// Apply startup boost if configured
if features.Enabled(features.CPUStartupBoost) {
Copy link
Member

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.

@kamarabbas99 kamarabbas99 force-pushed the feature-cpu-ac branch 4 times, most recently from f1fb13c to 9f96f8f Compare September 19, 2025 20:57
Copy link
Member

@omerap12 omerap12 left a 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

Comment on lines 227 to 232
// 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]
Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Got it. thanks!

@kamarabbas99 kamarabbas99 force-pushed the feature-cpu-ac branch 3 times, most recently from a348031 to 27cca7d Compare September 29, 2025 14:23
Copy link
Member

@adrianmoisey adrianmoisey left a 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

@jackfrancis
Copy link
Contributor

/release-note-edit

Apply CPU startup boost in admission controller if its set

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Sep 30, 2025
@adrianmoisey
Copy link
Member

I'm good with this
/lgtm
/cc @omerap12

@k8s-ci-robot k8s-ci-robot requested a review from omerap12 October 4, 2025 05:05
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 4, 2025
Copy link
Member

@omerap12 omerap12 left a 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

@k8s-ci-robot
Copy link
Contributor

[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 /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 Oct 4, 2025
@k8s-ci-robot k8s-ci-robot merged commit a3ce8e2 into kubernetes:experimental-cpu-boost Oct 4, 2025
8 checks passed
@omerap12
Copy link
Member

omerap12 commented Oct 4, 2025

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

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/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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants