Skip to content

Commit 0ec850d

Browse files
authored
Merge pull request #8349 from kamarabbas99/aep-changes-api
AEP-7862: Make API changes for CPU Startup boost
2 parents 4f30519 + 159afb1 commit 0ec850d

File tree

1 file changed

+55
-17
lines changed
  • vertical-pod-autoscaler/enhancements/7862-cpu-startup-boost

1 file changed

+55
-17
lines changed

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

Lines changed: 55 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,20 @@ VPA Admission Controller
8484

8585
1. The VPA Admission Controller modifies the pod's containers CPU request and
8686
limits to align with its `StartupBoost` policy, if specified, during the pod
87-
creation.
87+
creation. The boosted value is based on the VPA recommendation available at the
88+
time of admission. During the boost period, no resizing will take place.
8889

8990
1. The VPA Updater monitors pods targeted by the VPA object and when the pod
90-
condition is `Ready` and `StartupBoost.CPU.Duration` has elapsed, it scales
91-
down the CPU resources to the appropriate non-boosted value:
92-
`existing VPA recommendation for that container` (if any) OR the
93-
`CPU resources configured in the pod spec`.
91+
condition is `Ready` and `StartupBoost.CPU.Duration` has elapsed, it scales
92+
down the CPU resources to the appropriate non-boosted value. This "unboosting"
93+
resizes the pod to whatever the recommendation is at that moment. The specific
94+
behavior is determined by the VPA `updatePolicy`:
95+
* If `updatePolicy` is `Auto`, `Recreate` or `InPlaceOrRecreate`, the VPA
96+
Updater will apply the current VPA recommendation, even if it's higher than
97+
the boosted value.
98+
* If `updatePolicy` is `Off` for the VPA object, or `mode` is `Off` in a
99+
container policy, the VPA Updater will revert the CPU resources to the
100+
values specified in the pod spec.
94101
* The scale down is applied [in-place](https://github.com/kubernetes/enhancements/tree/master/keps/sig-node/1287-in-place-update-pod-resources).
95102

96103
### API Changes
@@ -101,22 +108,52 @@ The new `StartupBoost` parameter will be added to both:
101108
* [`ContainerResourcePolicy`](https://github.com/kubernetes/autoscaler/blob/vertical-pod-autoscaler-1.3.0/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1/types.go#L191):
102109
Will allow users to optionally customize the startup boost behavior for individual containers.
103110

111+
Here is the Go struct definition for `CPUStartupBoost`:
112+
113+
```go
114+
// +enum
115+
type CPUBoostType string
116+
117+
const (
118+
FactorType CPUBoostType = "Factor"
119+
QuantityType CPUBoostType = "Quantity"
120+
)
121+
122+
type CPUStartupBoost struct {
123+
// +unionDiscriminator
124+
// +required
125+
Type CPUBoostType `json:"type"`
126+
127+
// +unionMember=Factor
128+
// +optional
129+
Factor *int32 `json:"factor,omitempty"`
130+
131+
// +unionMember=Quantity
132+
// +optional
133+
Quantity *resource.Quantity `json:"quantity,omitempty"`
134+
135+
// +optional
136+
Duration *metav1.Duration `json:"duration,omitempty"`
137+
}
138+
```
139+
104140
`StartupBoost` will contain the following fields:
105141
* [Optional] `StartupBoost.CPU.Type` (type: `string`): A string that specifies
106142
the kind of boost to apply. Supported values are:
107-
* `Factor`: The `StartupBoost.CPU.Value` field will be interpreted as a
143+
* `Factor`: The `StartupBoost.CPU.Factor` field will be interpreted as a
108144
multiplier for the recommended CPU request. For example, a value of `2` will
109145
double the CPU request.
110-
* `Quantity`: The `StartupBoost.CPU.Value` field will be interpreted as an
146+
* `Quantity`: The `StartupBoost.CPU.Quantity` field will be interpreted as an
111147
absolute CPU resource quantity (e.g., `"500m"`, `"1"`) to be used as the CPU
112148
request or limit during the boost phase.
113149
* If not specified, `StartupBoost.CPU.Type` defaults to `Factor`.
114150

115-
* `StartupBoost.CPU.Value`: (type: `string`): A string representing the
116-
magnitude of the boost, interpreted based on the `StartupBoost.CPU.Type`.
117-
* If `StartupBoost.CPU.Type`is `Factor`, this field is optional and
118-
defaults to `"1"`.
151+
* [Optional] `StartupBoost.CPU.Factor`: (type: `integer`): The factor to apply to the CPU request. Defaults to 1 if not specified.
152+
* If `StartupBoost.CPU.Type`is `Factor`, this field is required.
153+
* If `StartupBoost.CPU.Type`is `Quantity`, this field is not allowed.
154+
* [Optional] `StartupBoost.CPU.Quantity`: (type: `resource.Quantity`): The absolute CPU resource quantity.
119155
* If `StartupBoost.CPU.Type`is `Quantity`, this field is required.
156+
* If `StartupBoost.CPU.Type`is `Factor`, this field is not allowed.
120157
* [Optional] `StartupBoost.CPU.Duration` (type: `duration`): if specified, it
121158
indicates for how long to keep the pod boosted **after** it goes to `Ready`.
122159
* It defaults to `0s` if not specified.
@@ -264,7 +301,7 @@ spec:
264301
updateMode: "Off"
265302
startupBoost:
266303
cpu:
267-
value: "3"
304+
factor: 3
268305
duration: 10s
269306
```
270307
@@ -300,7 +337,7 @@ spec:
300337
updateMode: "Auto"
301338
startupBoost:
302339
cpu:
303-
value: "3"
340+
factor: 3
304341
duration: 10s
305342
```
306343
@@ -333,7 +370,7 @@ spec:
333370
startupBoost:
334371
cpu:
335372
type: "Quantity"
336-
value: "2"
373+
quantity: "2"
337374
```
338375

339376
#### Startup CPU Boost Disabled & VPA Enabled
@@ -355,13 +392,13 @@ spec:
355392
name: example
356393
startupBoost:
357394
cpu:
358-
value: "2"
395+
factor: 2
359396
resourcePolicy:
360397
containerPolicies:
361398
- containerName: "disable-cpu-boost-for-this-container"
362399
startupBoost:
363400
cpu:
364-
value: "1"
401+
factor: 1
365402
```
366403

367404
#### Startup CPU Boost Enabled & VPA Enabled
@@ -394,11 +431,12 @@ spec:
394431
startupBoost:
395432
cpu:
396433
type: "Quantity"
397-
value: "4"
434+
quantity: "4"
398435
```
399436

400437
## Implementation History
401438

439+
* 2025-08-05: Make some API changes and clarify behavior during and after boost period in the workflow section.
402440
* 2025-06-23: Decouple Startup CPU Boost from InPlaceOrRecreate mode, allow
403441
users to specify a `startupBoost` config in `VerticalPodAutoscalerSpec` and in
404442
`ContainerPolicies` to make the API simpler and add more yaml examples.

0 commit comments

Comments
 (0)