Skip to content

Commit 79e5584

Browse files
authored
Merge pull request kubernetes#128682 from tallclair/ippr-beta
[FG:InPlacePodVerticalScaling] Graduate to Beta
2 parents 8115bac + 2935b10 commit 79e5584

File tree

8 files changed

+31
-11
lines changed

8 files changed

+31
-11
lines changed

pkg/apis/core/fuzzer/fuzzer.go

+17
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,23 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
309309
c.FuzzNoCustom(ct) // fuzz self without calling this function again
310310
ct.TerminationMessagePath = "/" + ct.TerminationMessagePath // Must be non-empty
311311
ct.TerminationMessagePolicy = "File"
312+
// Match defaulting in pkg/apis/core/v1/defaults.go.
313+
_, hasCPUReq := ct.Resources.Requests[core.ResourceCPU]
314+
_, hasCPULim := ct.Resources.Limits[core.ResourceCPU]
315+
_, hasMemReq := ct.Resources.Requests[core.ResourceMemory]
316+
_, hasMemLim := ct.Resources.Limits[core.ResourceMemory]
317+
if hasCPUReq || hasCPULim {
318+
ct.ResizePolicy = append(ct.ResizePolicy, core.ContainerResizePolicy{
319+
ResourceName: core.ResourceCPU,
320+
RestartPolicy: core.NotRequired,
321+
})
322+
}
323+
if hasMemReq || hasMemLim {
324+
ct.ResizePolicy = append(ct.ResizePolicy, core.ContainerResizePolicy{
325+
ResourceName: core.ResourceMemory,
326+
RestartPolicy: core.NotRequired,
327+
})
328+
}
312329
},
313330
func(ep *core.EphemeralContainer, c fuzz.Continue) {
314331
c.FuzzNoCustom(ep) // fuzz self without calling this function again

pkg/features/versioned_kube_features.go

+1
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,7 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate
404404

405405
InPlacePodVerticalScaling: {
406406
{Version: version.MustParse("1.27"), Default: false, PreRelease: featuregate.Alpha},
407+
{Version: version.MustParse("1.32"), Default: true, PreRelease: featuregate.Beta},
407408
},
408409

409410
InPlacePodVerticalScalingAllocatedStatus: {

pkg/kubelet/kuberuntime/kuberuntime_manager_test.go

+5
Original file line numberDiff line numberDiff line change
@@ -1264,6 +1264,11 @@ func verifyActions(t *testing.T, expected, actual *podActions, desc string) {
12641264
actual.ContainersToKill[k] = info
12651265
}
12661266
}
1267+
1268+
if expected.ContainersToUpdate == nil && actual.ContainersToUpdate != nil {
1269+
// No need to distinguish empty and nil maps for the test.
1270+
expected.ContainersToUpdate = map[v1.ResourceName][]containerToUpdateInfo{}
1271+
}
12671272
assert.Equal(t, expected, actual, desc)
12681273
}
12691274

pkg/kubelet/status/status_manager.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ func NewManager(kubeClient clientset.Interface, podManager PodManager, podDeleti
179179
podDeletionSafety: podDeletionSafety,
180180
podStartupLatencyHelper: podStartupLatencyHelper,
181181
stateFileDirectory: stateFileDirectory,
182+
state: state.NewNoopStateCheckpoint(),
182183
}
183184
}
184185

@@ -202,9 +203,6 @@ func isPodStatusByKubeletEqual(oldStatus, status *v1.PodStatus) bool {
202203
}
203204

204205
func (m *manager) Start() {
205-
// Initialize m.state to no-op state checkpoint manager
206-
m.state = state.NewNoopStateCheckpoint()
207-
208206
// Create pod allocation checkpoint manager even if client is nil so as to allow local get/set of AllocatedResources & Resize
209207
if utilfeature.DefaultFeatureGate.Enabled(features.InPlacePodVerticalScaling) {
210208
stateImpl, err := state.NewStateCheckpoint(m.stateFileDirectory, podStatusManagerStateFile)

test/e2e/common/node/pod_resize.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import (
2525
"k8s.io/apimachinery/pkg/api/resource"
2626
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2727
"k8s.io/apimachinery/pkg/types"
28-
"k8s.io/kubernetes/test/e2e/feature"
2928
"k8s.io/kubernetes/test/e2e/framework"
3029
e2enode "k8s.io/kubernetes/test/e2e/framework/node"
3130
e2epod "k8s.io/kubernetes/test/e2e/framework/pod"
@@ -1174,7 +1173,7 @@ func doPodResizeErrorTests(f *framework.Framework) {
11741173
// Above tests are performed by doSheduletTests() and doPodResizeResourceQuotaTests()
11751174
// in test/e2e/node/pod_resize.go
11761175

1177-
var _ = SIGDescribe("Pod InPlace Resize Container", framework.WithSerial(), feature.InPlacePodVerticalScaling, "[NodeAlphaFeature:InPlacePodVerticalScaling]", func() {
1176+
var _ = SIGDescribe("Pod InPlace Resize Container", framework.WithSerial(), func() {
11781177
f := framework.NewDefaultFramework("pod-resize-tests")
11791178

11801179
ginkgo.BeforeEach(func(ctx context.Context) {

test/e2e/feature/feature.go

-3
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,6 @@ var (
186186
// Ingress.networking.k8s.io to be present.
187187
Ingress = framework.WithFeature(framework.ValidFeatures.Add("Ingress"))
188188

189-
// TODO: document the feature (owning SIG, when to use this feature for a test)
190-
InPlacePodVerticalScaling = framework.WithFeature(framework.ValidFeatures.Add("InPlacePodVerticalScaling"))
191-
192189
// Owner: sig-network
193190
// Marks tests that require a cluster with dual-stack pod and service networks.
194191
IPv6DualStack = framework.WithFeature(framework.ValidFeatures.Add("IPv6DualStack"))

test/e2e/node/pod_resize.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import (
2727
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2828
"k8s.io/apimachinery/pkg/types"
2929
resourceapi "k8s.io/kubernetes/pkg/api/v1/resource"
30-
"k8s.io/kubernetes/test/e2e/feature"
3130
"k8s.io/kubernetes/test/e2e/framework"
3231
e2enode "k8s.io/kubernetes/test/e2e/framework/node"
3332
e2epod "k8s.io/kubernetes/test/e2e/framework/pod"
@@ -356,7 +355,7 @@ func doPodResizeSchedulerTests(f *framework.Framework) {
356355
})
357356
}
358357

359-
var _ = SIGDescribe(framework.WithSerial(), "Pod InPlace Resize Container (scheduler-focused)", feature.InPlacePodVerticalScaling, func() {
358+
var _ = SIGDescribe(framework.WithSerial(), "Pod InPlace Resize Container (scheduler-focused)", func() {
360359
f := framework.NewDefaultFramework("pod-resize-scheduler-tests")
361360
ginkgo.BeforeEach(func(ctx context.Context) {
362361
node, err := e2enode.GetRandomReadySchedulableNode(ctx, f.ClientSet)
@@ -368,7 +367,7 @@ var _ = SIGDescribe(framework.WithSerial(), "Pod InPlace Resize Container (sched
368367
doPodResizeSchedulerTests(f)
369368
})
370369

371-
var _ = SIGDescribe("Pod InPlace Resize Container", feature.InPlacePodVerticalScaling, func() {
370+
var _ = SIGDescribe("Pod InPlace Resize Container", func() {
372371
f := framework.NewDefaultFramework("pod-resize-tests")
373372

374373
ginkgo.BeforeEach(func(ctx context.Context) {

test/featuregates_linter/test_data/versioned_feature_list.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,10 @@
540540
lockToDefault: false
541541
preRelease: Alpha
542542
version: "1.27"
543+
- default: true
544+
lockToDefault: false
545+
preRelease: Beta
546+
version: "1.32"
543547
- name: InPlacePodVerticalScalingAllocatedStatus
544548
versionedSpecs:
545549
- default: false

0 commit comments

Comments
 (0)