Skip to content

Commit 012ad8a

Browse files
authored
Merge pull request #9164 from kamarabbas99/update-sb-aep
Update Startup boost AEP after API review
2 parents 078ba51 + 5a12168 commit 012ad8a

File tree

1 file changed

+33
-20
lines changed
  • vertical-pod-autoscaler/enhancements/7862-cpu-startup-boost

1 file changed

+33
-20
lines changed

vertical-pod-autoscaler/enhancements/7862-cpu-startup-boost/README.md

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pod (re-)creation time.
4747
* Allow VPA to scale pods down [in-place](https://github.com/kubernetes/enhancements/tree/master/keps/sig-node/1287-in-place-update-pod-resources)
4848
to the existing VPA recommendation for that container, if any, or to the CPU
4949
resources configured in the pod spec, as soon as their [`Ready`](https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-conditions)
50-
condition is true and `StartupBoost.CPU.Duration` has elapsed.
50+
condition is true and `StartupBoost.CPU.DurationSeconds` has elapsed.
5151

5252
### Non-Goals
5353

@@ -79,13 +79,23 @@ VPA object) without having to ALSO use the traditional VPA functionality.
7979
1. When a pod targeted by that VPA is created, the kube-apiserver invokes the
8080
VPA Admission Controller
8181

82-
1. The VPA Admission Controller modifies the pod's containers CPU request and
83-
limits to align with its `StartupBoost` policy, if specified, during the pod
84-
creation. The boosted value is based on the VPA recommendation available at the
85-
time of admission. During the boost period, no resizing will take place.
82+
83+
1. The VPA Admission Controller modifies the pod's containers CPU request and
84+
limits to align with its `StartupBoost` policy, if specified, during the pod
85+
creation. The base value for the boost calculation is the VPA recommended CPU
86+
request. If the VPA recommendation is not available or is zero, the container's
87+
original CPU request from the Pod spec is used as the base.
88+
89+
The behavior for CPU limits depends on the `ControlledValues` setting in the
90+
`ContainerResourcePolicy`:
91+
92+
* If `ControlledValues` is `RequestsOnly` , the boosted CPU request
93+
will be capped just below the container's original CPU limit(to preserve pod QoS), if one is set.
94+
* If `ControlledValues` is `RequestsAndLimits` (the default), the CPU limit is also boosted.
95+
The new limit is calculated to maintain the container's original limit-to-request ratio, applied to the new boosted CPU request. In cases where this ratio cannot be established (e.g., if the original CPU limit was unspecified), the limit will not be changed by the boost.
8696

8797
1. The VPA Updater monitors pods targeted by the VPA object and when the pod
88-
condition is `Ready` and `StartupBoost.CPU.Duration` has elapsed, it scales
98+
condition is `Ready` and `StartupBoost.CPU.DurationSeconds` has elapsed, it scales
8999
down the CPU resources to the appropriate non-boosted value. This "unboosting"
90100
resizes the pod to whatever the recommendation is at that moment. The specific
91101
behavior is determined by the VPA `updatePolicy`:
@@ -130,7 +140,7 @@ type CPUStartupBoost struct {
130140
Quantity *resource.Quantity `json:"quantity,omitempty"`
131141

132142
// +optional
133-
Duration *metav1.Duration `json:"duration,omitempty"`
143+
DurationSeconds *int32 `json:"durationSeconds,omitempty"`
134144
}
135145
```
136146

@@ -144,19 +154,22 @@ type CPUStartupBoost struct {
144154
additional CPU resource quantity (e.g., `"500m"`, `"1"`) to be added to the existing CPU
145155
request or limit during the boost phase.
146156

157+
> [!NOTE]
158+
> For forward compatibility, an unrecognized `StartupBoost.CPU.Type` value will be treated as no boost.
159+
147160
* [Optional] `StartupBoost.CPU.Factor`: (type: `integer`): The factor to apply to the CPU request. Defaults to 1 if not specified.
148161
* If `StartupBoost.CPU.Type`is `Factor`, this field is required.
149162
* If `StartupBoost.CPU.Type`is `Quantity`, this field is not allowed.
150163
* [Optional] `StartupBoost.CPU.Quantity`: (type: `resource.Quantity`): The additional CPU resource quantity.
151164
* If `StartupBoost.CPU.Type`is `Quantity`, this field is required.
152165
* If `StartupBoost.CPU.Type`is `Factor`, this field is not allowed.
153-
* [Optional] `StartupBoost.CPU.Duration` (type: `duration`): if specified, it
166+
* [Optional] `StartupBoost.CPU.DurationSeconds` (type: `integer`): if specified, it
154167
indicates for how long to keep the pod boosted **after** it goes to `Ready`.
155-
* It defaults to `0s` if not specified.
168+
* It defaults to `0` if not specified.
156169

157170
> [!IMPORTANT]
158171
> The boosted CPU value will be capped by
159-
> [`--container-recommendation-max-allowed-cpu`](https://github.com/kubernetes/autoscaler/blob/4d294562e505431d518a81e8833accc0ec99c9b8/vertical-pod-autoscaler/pkg/recommender/main.go#L122)
172+
> [`--max-allowed-cpu-boost`](https://github.com/kubernetes/autoscaler/blob/4b40a55bebd2ce184b289cd028969182d15f412c/vertical-pod-autoscaler/pkg/admission-controller/main.go#L86C1-L86C2)
160173
> flag value, if set.
161174
162175
> [!NOTE]
@@ -165,7 +178,7 @@ type CPUStartupBoost struct {
165178
> [Readiness or a Startup probe](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/)
166179
> for the containers that will be CPU boosted. Check the [Test Plan](#test-plan)
167180
> section for more details on this feature's behavior for different combinations
168-
> of probers + `StartupBoost.CPU.Duration`.
181+
> of probers + `StartupBoost.CPU.DurationSeconds`.
169182
170183
#### Priority of `StartupBoost`
171184

@@ -255,18 +268,18 @@ Other than comprehensive unit tests, we will also add the following scenarios to
255268
our e2e tests:
256269

257270
* CPU Startup Boost recommendation is applied to pod controlled by VPA until it
258-
becomes `Ready` and `StartupBoost.CPU.Duration` has elapsed. Then, the pod is
271+
becomes `Ready` and `StartupBoost.CPU.DurationSeconds` has elapsed. Then, the pod is
259272
scaled back down in-place. We'll also test the following sub-cases:
260273
* Boost is applied to all containers of a pod.
261274
* Boost is applied only to a subset of containers in a pod.
262-
* Combinations of probes + `StartupBoost.CPU.Duration`:
263-
* No probes and no `StartupBoost.CPU.Duration` specified: unboost will
275+
* Combinations of probes + `StartupBoost.CPU.DurationSeconds`:
276+
* No probes and no `StartupBoost.CPU.DurationSeconds` specified: unboost will
264277
likely happen immediately.
265-
* No probes and a 60s `StartupBoost.CPU.Duration`: unboost will likely
278+
* No probes and a 60s `StartupBoost.CPU.DurationSeconds`: unboost will likely
266279
happen after 60s.
267-
* A readiness/startup probe and no `StartupBoost.CPU.Duration` specified:
280+
* A readiness/startup probe and no `StartupBoost.CPU.DurationSeconds` specified:
268281
unboost will likely as soon as the pod becomes `Ready`.
269-
* A readiness/startup probe and a 60s `StartupBoost.CPU.Duration`
282+
* A readiness/startup probe and a 60s `StartupBoost.CPU.DurationSeconds`
270283
specified: unboost will likely happen 60s **after** the pod becomes `Ready`.
271284

272285
* Pod is not evicted if the in-place update fails when scaling the pod back
@@ -299,7 +312,7 @@ spec:
299312
cpu:
300313
type: "Factor"
301314
factor: 3
302-
duration: 10s
315+
durationSeconds: 10
303316
```
304317
305318
#### Startup CPU Boost Disabled & VPA Enabled
@@ -336,7 +349,7 @@ spec:
336349
cpu:
337350
type: "Factor"
338351
factor: 3
339-
duration: 10s
352+
durationSeconds: 10
340353
```
341354
342355
### Per-container configurations (`startupBoost` configured in `ContainerPolicies`)
@@ -436,10 +449,10 @@ spec:
436449

437450
## Implementation History
438451

452+
* 2026-02-02: Change `startupBoost.cpu.duration` to `startupBoost.cpu.durationSeconds` and its type from string to int32 (seconds).
439453
* 2025-10-04: Update `startupBoost.cpu.type` field to correctly indicate it is a required field, not optional. The field has no default value and must be explicitly set to either "Factor" or "Quantity".
440454
* 2025-08-05: Make some API changes and clarify behavior during and after boost period in the workflow section.
441455
* 2025-06-23: Decouple Startup CPU Boost from InPlaceOrRecreate mode, allow
442456
users to specify a `startupBoost` config in `VerticalPodAutoscalerSpec` and in
443457
`ContainerPolicies` to make the API simpler and add more yaml examples.
444458
* 2025-03-20: Initial version.
445-

0 commit comments

Comments
 (0)