Skip to content

Commit 6415e36

Browse files
committed
Introduce API changes and fetaure gate CPU startup boost
1 parent 2289138 commit 6415e36

File tree

4 files changed

+135
-0
lines changed

4 files changed

+135
-0
lines changed

vertical-pod-autoscaler/deploy/vpa-v1-crd-gen.yaml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,9 +372,82 @@ spec:
372372
- Auto
373373
- "Off"
374374
type: string
375+
startupBoost:
376+
description: |-
377+
StartupBoost specifies the startup boost policy for the container.
378+
This overrides any pod-level startup boost policy.
379+
properties:
380+
cpu:
381+
description: CPU specifies the CPU startup boost policy.
382+
properties:
383+
duration:
384+
description: |-
385+
Duration indicates for how long to keep the pod boosted after it goes to Ready.
386+
Defaults to 0s.
387+
type: string
388+
factor:
389+
description: Factor specifies the factor to apply
390+
to the CPU request.
391+
format: int32
392+
type: integer
393+
quantity:
394+
anyOf:
395+
- type: integer
396+
- type: string
397+
description: Quantity specifies the absolute CPU
398+
resource quantity.
399+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
400+
x-kubernetes-int-or-string: true
401+
type:
402+
description: |-
403+
Type specifies the kind of boost to apply.
404+
Supported values are: "Factor", "Quantity".
405+
Defaults to "Factor".
406+
enum:
407+
- Factor
408+
- Quantity
409+
type: string
410+
type: object
411+
type: object
375412
type: object
376413
type: array
377414
type: object
415+
startupBoost:
416+
description: StartupBoost specifies the startup boost policy for the
417+
pod.
418+
properties:
419+
cpu:
420+
description: CPU specifies the CPU startup boost policy.
421+
properties:
422+
duration:
423+
description: |-
424+
Duration indicates for how long to keep the pod boosted after it goes to Ready.
425+
Defaults to 0s.
426+
type: string
427+
factor:
428+
description: Factor specifies the factor to apply to the CPU
429+
request.
430+
format: int32
431+
type: integer
432+
quantity:
433+
anyOf:
434+
- type: integer
435+
- type: string
436+
description: Quantity specifies the absolute CPU resource
437+
quantity.
438+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
439+
x-kubernetes-int-or-string: true
440+
type:
441+
description: |-
442+
Type specifies the kind of boost to apply.
443+
Supported values are: "Factor", "Quantity".
444+
Defaults to "Factor".
445+
enum:
446+
- Factor
447+
- Quantity
448+
type: string
449+
type: object
450+
type: object
378451
targetRef:
379452
description: |-
380453
TargetRef points to the controller managing the set of pods for the

vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1/types.go

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package v1
1919
import (
2020
autoscaling "k8s.io/api/autoscaling/v1"
2121
v1 "k8s.io/api/core/v1"
22+
"k8s.io/apimachinery/pkg/api/resource"
2223
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2324
)
2425

@@ -107,8 +108,55 @@ type VerticalPodAutoscalerSpec struct {
107108
// recommendation) or contain exactly one recommender.
108109
// +optional
109110
Recommenders []*VerticalPodAutoscalerRecommenderSelector `json:"recommenders,omitempty" protobuf:"bytes,4,opt,name=recommenders"`
111+
112+
// StartupBoost specifies the startup boost policy for the pod.
113+
// +optional
114+
StartupBoost *StartupBoost `json:"startupBoost,omitempty" protobuf:"bytes,5,opt,name=startupBoost"`
115+
}
116+
117+
// StartupBoost defines the startup boost policy.
118+
type StartupBoost struct {
119+
// CPU specifies the CPU startup boost policy.
120+
// If this field is not set, no startup boost is applied.
121+
// +optional
122+
CPU *CPUStartupBoost `json:"cpu,omitempty" protobuf:"bytes,1,opt,name=cpu"`
123+
}
124+
125+
// CPUStartupBoost defines the CPU startup boost policy.
126+
type CPUStartupBoost struct {
127+
// Type specifies the kind of boost to apply.
128+
// Supported values are: "Factor", "Quantity".
129+
// Defaults to "Factor".
130+
// +optional
131+
Type *StartupBoostType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type"`
132+
133+
// Factor specifies the factor to apply to the CPU request.
134+
// This field is to be used only when Type is "Factor".
135+
// +optional
136+
Factor *int32 `json:"factor,omitempty" protobuf:"bytes,2,opt,name=factor"`
137+
138+
// Quantity specifies the absolute CPU resource quantity.
139+
// This field is to be used only when Type is "Quantity".
140+
// +optional
141+
Quantity *resource.Quantity `json:"quantity,omitempty" protobuf:"bytes,3,opt,name=quantity"`
142+
143+
// Duration indicates for how long to keep the pod boosted after it goes to Ready.
144+
// Defaults to 0s.
145+
// +optional
146+
Duration *metav1.Duration `json:"duration,omitempty" protobuf:"bytes,4,opt,name=duration"`
110147
}
111148

149+
// StartupBoostType is the type of startup boost.
150+
// +kubebuilder:validation:Enum=Factor;Quantity
151+
type StartupBoostType string
152+
153+
const (
154+
// FactorStartupBoostType applies a factor to the CPU.
155+
FactorStartupBoostType StartupBoostType = "Factor"
156+
// QuantityStartupBoostType applies a fixed quantity to the CPU.
157+
QuantityStartupBoostType StartupBoostType = "Quantity"
158+
)
159+
112160
// EvictionChangeRequirement refers to the relationship between the new target recommendation for a Pod and its current requests, what kind of change is necessary for the Pod to be evicted
113161
// +kubebuilder:validation:Enum:=TargetHigherThanRequests;TargetLowerThanRequests
114162
type EvictionChangeRequirement string
@@ -221,6 +269,11 @@ type ContainerResourcePolicy struct {
221269
// The default is "RequestsAndLimits".
222270
// +optional
223271
ControlledValues *ContainerControlledValues `json:"controlledValues,omitempty" protobuf:"bytes,6,rep,name=controlledValues"`
272+
273+
// StartupBoost specifies the startup boost policy for the container.
274+
// This overrides any pod-level startup boost policy.
275+
// +optional
276+
StartupBoost *StartupBoost `json:"startupBoost,omitempty" protobuf:"bytes,7,opt,name=startupBoost"`
224277
}
225278

226279
const (

vertical-pod-autoscaler/pkg/features/features.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ const (
4343
// alpha: v1.4.0
4444
// components: admission-controller, updater
4545

46+
// alpha: v1.5.0
47+
// components: admission-controller, updater
48+
49+
// CPUStartupBoost enables the CPU startup boost feature.
50+
CPUStartupBoost featuregate.Feature = "CPUStartupBoost"
51+
4652
// InPlaceOrRecreate enables the InPlaceOrRecreate update mode to be used.
4753
// Requires KEP-1287 InPlacePodVerticalScaling feature-gate to be enabled on the cluster.
4854
InPlaceOrRecreate featuregate.Feature = "InPlaceOrRecreate"

vertical-pod-autoscaler/pkg/features/versioned_features.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ import (
2727

2828
// Entries are alphabetized.
2929
var defaultVersionedFeatureGates = map[featuregate.Feature]featuregate.VersionedSpecs{
30+
CPUStartupBoost: {
31+
{Version: version.MustParse("1.5"), Default: false, PreRelease: featuregate.Alpha},
32+
},
3033
InPlaceOrRecreate: {
3134
{Version: version.MustParse("1.4"), Default: false, PreRelease: featuregate.Alpha},
3235
},

0 commit comments

Comments
 (0)