Skip to content

Introduce API changes and fetaure gate CPU startup boost #8417

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

Open
wants to merge 1 commit into
base: experimental-cpu-boost
Choose a base branch
from

Conversation

kamarabbas99
Copy link
Contributor

What type of PR is this?

/kind feature
/kind api-change

What this PR does / why we need it:

API Extension: Adds a startupBoost field to the VerticalPodAutoscalerSpec and ContainerResourcePolicy to allow users to define a boost factor or quantity and a
duration.

Which issue(s) this PR fixes:

Fixes #7862

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)

@k8s-ci-robot
Copy link
Contributor

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

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 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. 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. do-not-merge/needs-area labels Aug 7, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: kamarabbas99
Once this PR has been reviewed and has the lgtm label, please assign omerap12 for approval. For more information see the 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 k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. area/vertical-pod-autoscaler labels Aug 7, 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 size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed do-not-merge/needs-area labels Aug 7, 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 7, 2025
@kamarabbas99
Copy link
Contributor Author

/cc omerap12 laoj2

@k8s-ci-robot k8s-ci-robot requested review from laoj2 and omerap12 August 7, 2025 20:31
@kamarabbas99 kamarabbas99 force-pushed the feature-cpu-boost-api branch 2 times, most recently from 5bd5b24 to 6415e36 Compare August 7, 2025 21:02
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.

Also missing validation: https://github.com/kubernetes/autoscaler/tree/master/vertical-pod-autoscaler/enhancements/7862-cpu-startup-boost#validation

This PR introduces API changes - so we need to adjust all API related stuff including validation.

@@ -27,6 +27,9 @@ import (

// Entries are alphabetized.
var defaultVersionedFeatureGates = map[featuregate.Feature]featuregate.VersionedSpecs{
CPUStartupBoost: {
Copy link
Member

Choose a reason for hiding this comment

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

Does CPUStartupBoost correct? I will never understand this stuff .. lol
@adrianmoisey, you are the expert on this

Copy link
Member

Choose a reason for hiding this comment

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

Yup, in this place it's correct (from what I understand)

@kamarabbas99 kamarabbas99 force-pushed the feature-cpu-boost-api branch from 6415e36 to 4f0b0b3 Compare August 8, 2025 18:11
// Defaults to "Factor".
// +unionDiscriminator
// +required
Type *StartupBoostType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type"`
Copy link
Member

Choose a reason for hiding this comment

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

Required field shouldn't have omitempty: https://github.com/kubernetes-sigs/kube-api-linter/blob/main/docs/linters.md#requiredfields

Suggested change
Type *StartupBoostType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type"`
Type *StartupBoostType `json:"type" protobuf:"bytes,1,opt,name=type"`

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Made it optional with a default value.

@@ -27,6 +27,9 @@ import (

// Entries are alphabetized.
var defaultVersionedFeatureGates = map[featuregate.Feature]featuregate.VersionedSpecs{
CPUStartupBoost: {
Copy link
Member

Choose a reason for hiding this comment

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

Yup, in this place it's correct (from what I understand)

Comment on lines +201 to +205
if boostType == nil {
// Default to Factor when type is not specified.
defaultType := vpa_types.FactorStartupBoostType
boostType = &defaultType
}
Copy link
Member

Choose a reason for hiding this comment

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

I see that in the API type is marked as required, I'm wondering if that is incorrect?

Copy link
Contributor Author

@kamarabbas99 kamarabbas99 Aug 11, 2025

Choose a reason for hiding this comment

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

Made the API field optional with default value of Factor.

@@ -27,6 +27,9 @@ import (

// Entries are alphabetized.
var defaultVersionedFeatureGates = map[featuregate.Feature]featuregate.VersionedSpecs{
CPUStartupBoost: {
{Version: version.MustParse("1.5"), Default: false, PreRelease: featuregate.Alpha},
Copy link
Contributor

Choose a reason for hiding this comment

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

@adrianmoisey with InPlaceOrRecreate graduating to Beta in 1.5 (https://github.com/kubernetes/autoscaler/pull/8423/files), does it make sense to make CPU boost available in 1.6+? So it doesn't block the graduation?

Copy link
Member

Choose a reason for hiding this comment

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

Not sure I understand, are you suggestion that CPUStartupBoost be available in 1.6 as alpha (default off) or as something else?
Why can't CPUStartupBoost be available as alpha (default off) in 1.5?

Copy link
Contributor

Choose a reason for hiding this comment

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

It could be available as alpha in 1.5. I'm suggesting that we could release CPU boost in another version (e.g 1.6), because CPU boost is not code complete/(stable too?) yet and we may want to cut a new VPA 1.5.0 release soon (to introduce InPlaceOrRecreate beta) without being blocked by this feature.

Copy link
Member

Choose a reason for hiding this comment

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

I see.
Well, if this feature is ready by the time we cut 1.5.0 (which may be soon after Kubernetes 1.34, I assume?), then it can go into 1.5.0.
If the feature is not code complete, and PRs not merged into 1.5.0, that's fine too, we just wait until 1.6.0

Copy link
Member

Choose a reason for hiding this comment

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

Agree with Adrian.

@kamarabbas99 kamarabbas99 force-pushed the feature-cpu-boost-api branch from 4f0b0b3 to 25eab9b Compare August 11, 2025 13:54
@kamarabbas99 kamarabbas99 force-pushed the feature-cpu-boost-api branch from 25eab9b to 3159fb2 Compare August 11, 2025 13:58
@kamarabbas99 kamarabbas99 force-pushed the feature-cpu-boost-api branch from 3159fb2 to ded6238 Compare August 11, 2025 17:42
@adrianmoisey
Copy link
Member

So far so good. The flag docs just need updating, then it think it's good to go

Copy link
Contributor

@laoj2 laoj2 left a comment

Choose a reason for hiding this comment

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

Thanks @kamarabbas99!

return fmt.Errorf("invalid StartupBoost.CPU.Quantity: %v", err)
}
}
return nil
Copy link
Contributor

Choose a reason for hiding this comment

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

what about checking if both Factor and Quantity are set at the same time? (So we ensure only one of them is set at a time)

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Awesome, I missed that! Thanks @omerap12

@kamarabbas99 kamarabbas99 force-pushed the feature-cpu-boost-api branch from ded6238 to 609f127 Compare August 12, 2025 20:49
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 12, 2025
@kamarabbas99 kamarabbas99 force-pushed the feature-cpu-boost-api branch from 609f127 to 89d5553 Compare August 13, 2025 20:41
@kamarabbas99 kamarabbas99 force-pushed the feature-cpu-boost-api branch from 89d5553 to 908d6e0 Compare August 13, 2025 20:42
@adrianmoisey
Copy link
Member

Oh, and there's a script to update the API docs too: https://github.com/kubernetes/autoscaler/blob/master/vertical-pod-autoscaler/hack/generate-api-docs.sh
(we really need to be better at adding these things to CI)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/vertical-pod-autoscaler cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. 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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.

5 participants