Skip to content

Commit 419eedc

Browse files
committed
Merge master into experimental-cpu-boost-v2
1 parent 68dfbad commit 419eedc

File tree

12 files changed

+128
-27
lines changed

12 files changed

+128
-27
lines changed

vertical-pod-autoscaler/docs/features.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,16 @@
1313
- [Skipping Disruption Budget for Non-Disruptive Updates](#skipping-disruption-budget-for-non-disruptive-updates)
1414
- [When Disruption Budgets Are Still Respected](#when-disruption-budgets-are-still-respected)
1515
- [Requirements:](#requirements)
16+
- [Configuration](#configuration)
1617
- [Limitations](#limitations)
1718
- [Fallback Behavior](#fallback-behavior)
1819
- [Monitoring](#monitoring)
1920
- [CPU Startup Boost](#cpu-startup-boost)
21+
- [Usage](#usage-1)
22+
- [Behavior](#behavior-1)
23+
- [Requirements](#requirements-1)
24+
- [Configuration](#configuration-1)
25+
<!-- /toc -->
2026
<!-- /toc -->
2127

2228
## Limits control

vertical-pod-autoscaler/e2e/v1/admission_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,7 @@ var _ = AdmissionControllerE2eDescribe("Admission-controller", func() {
11001100

11011101
var _ = AdmissionControllerE2eDescribe("Admission-controller", func() {
11021102
f := framework.NewDefaultFramework("vertical-pod-autoscaling")
1103-
f.NamespacePodSecurityEnforceLevel = podsecurity.LevelBaseline
1103+
f.NamespacePodSecurityLevel = podsecurity.LevelBaseline
11041104

11051105
ginkgo.BeforeEach(func() {
11061106
waitForVpaWebhookRegistration(f)

vertical-pod-autoscaler/e2e/v1/full_vpa.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ var _ = FullVpaE2eDescribe("Pods under VPA with CPUStartupBoost", func() {
367367
})
368368

369369
f := framework.NewDefaultFramework("vertical-pod-autoscaling")
370-
f.NamespacePodSecurityEnforceLevel = podsecurity.LevelBaseline
370+
f.NamespacePodSecurityLevel = podsecurity.LevelBaseline
371371

372372
ginkgo.Describe("have CPU startup boost recommendation applied", func() {
373373
ginkgo.BeforeEach(func() {

vertical-pod-autoscaler/e2e/v1/updater.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ var _ = UpdaterE2eDescribe("Updater", func() {
211211

212212
var _ = UpdaterE2eDescribe("Updater", func() {
213213
f := framework.NewDefaultFramework("vertical-pod-autoscaling")
214-
f.NamespacePodSecurityEnforceLevel = podsecurity.LevelBaseline
214+
f.NamespacePodSecurityLevel = podsecurity.LevelBaseline
215215

216216
f.It("Unboost pods when they become Ready", framework.WithFeatureGate(features.CPUStartupBoost), func() {
217217
const statusUpdateInterval = 10 * time.Second

vertical-pod-autoscaler/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ require (
1818
k8s.io/code-generator v0.35.0
1919
k8s.io/component-base v0.35.0
2020
k8s.io/klog/v2 v2.130.1
21-
k8s.io/kubernetes v1.34.0
21+
k8s.io/kubernetes v1.35.0
2222
k8s.io/metrics v0.35.0
2323
k8s.io/utils v0.0.0-20251002143259-bc988d571ff4
2424
)
@@ -84,7 +84,7 @@ require (
8484
gopkg.in/inf.v0 v0.9.1 // indirect
8585
gopkg.in/yaml.v3 v3.0.1 // indirect
8686
k8s.io/apiextensions-apiserver v0.0.0 // indirect
87-
k8s.io/apiserver v0.34.0 // indirect
87+
k8s.io/apiserver v0.35.0 // indirect
8888
k8s.io/controller-manager v0.0.0 // indirect
8989
k8s.io/gengo/v2 v2.0.0-20250922181213-ec3ebc5fd46b // indirect
9090
k8s.io/kube-openapi v0.0.0-20251125145642-4e65d59e963e // indirect

vertical-pod-autoscaler/go.sum

Lines changed: 99 additions & 8 deletions
Large diffs are not rendered by default.

vertical-pod-autoscaler/pkg/admission-controller/resource/pod/patch/resource_updates.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package patch
1818

1919
import (
20+
"errors"
2021
"fmt"
2122
"strings"
2223

@@ -81,7 +82,6 @@ func (c *resourcesUpdatesPatchCalculator) CalculatePatches(pod *core.Pod, vpa *v
8182
updatesAnnotation := []string{}
8283
cpuStartupBoostEnabled := features.Enabled(features.CPUStartupBoost)
8384
for i := range containersResources {
84-
8585
// Apply startup boost if configured
8686
if cpuStartupBoostEnabled {
8787
// Get the container resource policy to check for scaling mode.
@@ -182,18 +182,18 @@ func (c *resourcesUpdatesPatchCalculator) calculateBoostedCPUValue(baseCPU resou
182182
switch boostType {
183183
case vpa_types.FactorStartupBoostType:
184184
if startupBoost.CPU.Factor == nil {
185-
return nil, fmt.Errorf("startupBoost.CPU.Factor is required when Type is Factor or not specified")
185+
return nil, errors.New("startupBoost.CPU.Factor is required when Type is Factor or not specified")
186186
}
187187
factor := *startupBoost.CPU.Factor
188188
if factor < 1 {
189-
return nil, fmt.Errorf("boost factor must be >= 1")
189+
return nil, errors.New("boost factor must be >= 1")
190190
}
191191
boostedCPUMilli := baseCPU.MilliValue()
192192
boostedCPUMilli = int64(float64(boostedCPUMilli) * float64(factor))
193193
return resource.NewMilliQuantity(boostedCPUMilli, resource.DecimalSI), nil
194194
case vpa_types.QuantityStartupBoostType:
195195
if startupBoost.CPU.Quantity == nil {
196-
return nil, fmt.Errorf("startupBoost.CPU.Quantity is required when Type is Quantity")
196+
return nil, errors.New("startupBoost.CPU.Quantity is required when Type is Quantity")
197197
}
198198
quantity := *startupBoost.CPU.Quantity
199199
boostedCPUMilli := baseCPU.MilliValue() + quantity.MilliValue()
@@ -255,6 +255,8 @@ func (c *resourcesUpdatesPatchCalculator) applyControlledCPUResources(container
255255
if newLimit, ok := newLimits[core.ResourceCPU]; ok {
256256
containerResources.Limits[core.ResourceCPU] = newLimit
257257
}
258+
default:
259+
// Do nothing
258260
}
259261
return nil
260262
}

vertical-pod-autoscaler/pkg/admission-controller/resource/pod/patch/resource_updates_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package patch
1818

1919
import (
20+
"errors"
2021
"fmt"
2122
"strings"
2223
"testing"
@@ -557,7 +558,7 @@ func TestCalculatePatches_StartupBoost(t *testing.T) {
557558
},
558559
maxAllowedCpu: resource.QuantityValue{},
559560
featureGateEnabled: true,
560-
expectError: fmt.Errorf("boost factor must be >= 1"),
561+
expectError: errors.New("boost factor must be >= 1"),
561562
},
562563
{
563564
name: "quantity less than request",
@@ -824,7 +825,7 @@ func TestCalculatePatches_StartupBoost(t *testing.T) {
824825
},
825826
maxAllowedCpu: resource.QuantityValue{},
826827
featureGateEnabled: true,
827-
expectError: fmt.Errorf("unsupported startup boost type: Invalid"),
828+
expectError: errors.New("unsupported startup boost type: Invalid"),
828829
},
829830
{
830831
name: "startup boost container policy takes precedence",

vertical-pod-autoscaler/pkg/admission-controller/resource/vpa/handler.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,14 +222,14 @@ func validateStartupBoost(startupBoost *vpa_types.StartupBoost, isCreate bool) e
222222
switch boostType {
223223
case vpa_types.FactorStartupBoostType:
224224
if cpuBoost.Factor == nil {
225-
return fmt.Errorf("startupBoost.cpu.factor is required when type is Factor")
225+
return errors.New("startupBoost.cpu.factor is required when type is Factor")
226226
}
227227
if *cpuBoost.Factor < 1 {
228-
return fmt.Errorf("invalid startupBoost.cpu.factor: must be >= 1 for type Factor")
228+
return errors.New("invalid startupBoost.cpu.factor: must be >= 1 for type Factor")
229229
}
230230
case vpa_types.QuantityStartupBoostType:
231231
if cpuBoost.Quantity == nil {
232-
return fmt.Errorf("startupBoost.cpu.quantity is required when type is Quantity")
232+
return errors.New("startupBoost.cpu.quantity is required when type is Quantity")
233233
}
234234
if err := validateCPUResolution(*cpuBoost.Quantity); err != nil {
235235
return fmt.Errorf("invalid startupBoost.cpu.quantity: %v", err)

vertical-pod-autoscaler/pkg/admission-controller/resource/vpa/handler_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ func TestValidateVPA(t *testing.T) {
383383
},
384384
},
385385
isCreate: true,
386-
expectError: fmt.Errorf("invalid startupBoost: invalid startupBoost.cpu.factor: must be >= 1 for type Factor"),
386+
expectError: errors.New("invalid startupBoost: invalid startupBoost.cpu.factor: must be >= 1 for type Factor"),
387387
},
388388
{
389389
name: "container startupBoost with bad factor",
@@ -405,7 +405,7 @@ func TestValidateVPA(t *testing.T) {
405405
},
406406
},
407407
isCreate: true,
408-
expectError: fmt.Errorf("invalid startupBoost in container loot box: invalid startupBoost.cpu.factor: must be >= 1 for type Factor"),
408+
expectError: errors.New("invalid startupBoost in container loot box: invalid startupBoost.cpu.factor: must be >= 1 for type Factor"),
409409
},
410410
{
411411
name: "top-level startupBoost with bad quantity",
@@ -694,9 +694,10 @@ func TestValidateVPA(t *testing.T) {
694694
if tc.inPlaceOrRecreateFeatureGateDisabled {
695695
featuregatetesting.SetFeatureGateEmulationVersionDuringTest(t, features.MutableFeatureGate, version.MustParse("1.5"))
696696
featuregatetesting.SetFeatureGateDuringTest(t, features.MutableFeatureGate, features.InPlaceOrRecreate, !tc.inPlaceOrRecreateFeatureGateDisabled)
697+
} else {
698+
featuregatetesting.SetFeatureGateDuringTest(t, features.MutableFeatureGate, features.CPUStartupBoost, !tc.cpuStartupBoostFeatureGateDisabled)
697699
}
698700
featuregatetesting.SetFeatureGateDuringTest(t, features.MutableFeatureGate, features.PerVPAConfig, !tc.PerVPAConfigDisabled)
699-
featuregatetesting.SetFeatureGateDuringTest(t, features.MutableFeatureGate, features.CPUStartupBoost, !tc.cpuStartupBoostFeatureGateDisabled)
700701
err := ValidateVPA(&tc.vpa, tc.isCreate)
701702
if tc.expectError == nil {
702703
assert.NoError(t, err)

0 commit comments

Comments
 (0)