From dcbed2fbdce8efbd26a9e97e628236de19b52d40 Mon Sep 17 00:00:00 2001 From: AxeZhan Date: Sat, 28 Jun 2025 17:35:14 +0800 Subject: [PATCH] Graduate PodLifecycleSleepAction to GA --- pkg/api/pod/util_test.go | 1 + pkg/features/kube_features.go | 1 + pkg/kubelet/lifecycle/handlers_test.go | 5 ----- pkg/registry/core/pod/strategy_test.go | 1 + .../reference/versioned_feature_list.yaml | 4 ++++ test/e2e/feature/feature.go | 3 --- 6 files changed, 7 insertions(+), 8 deletions(-) diff --git a/pkg/api/pod/util_test.go b/pkg/api/pod/util_test.go index 8faf47aeac8..55a86b4573b 100644 --- a/pkg/api/pod/util_test.go +++ b/pkg/api/pod/util_test.go @@ -3643,6 +3643,7 @@ func TestDropPodLifecycleSleepAction(t *testing.T) { for i, tc := range testCases { t.Run(fmt.Sprintf("test_%d", i), func(t *testing.T) { + featuregatetesting.SetFeatureGateEmulationVersionDuringTest(t, utilfeature.DefaultFeatureGate, version.MustParse("1.33")) featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.PodLifecycleSleepAction, tc.gateEnabled) // preStop diff --git a/pkg/features/kube_features.go b/pkg/features/kube_features.go index 259be4e9b49..95044208c36 100644 --- a/pkg/features/kube_features.go +++ b/pkg/features/kube_features.go @@ -1406,6 +1406,7 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate PodLifecycleSleepAction: { {Version: version.MustParse("1.29"), Default: false, PreRelease: featuregate.Alpha}, {Version: version.MustParse("1.30"), Default: true, PreRelease: featuregate.Beta}, + {Version: version.MustParse("1.34"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // GA in 1.34; remove in 1.37 }, PodLifecycleSleepActionAllowZero: { diff --git a/pkg/kubelet/lifecycle/handlers_test.go b/pkg/kubelet/lifecycle/handlers_test.go index 218e86d4e3a..af4a3b612f7 100644 --- a/pkg/kubelet/lifecycle/handlers_test.go +++ b/pkg/kubelet/lifecycle/handlers_test.go @@ -32,12 +32,9 @@ import ( v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/intstr" - utilfeature "k8s.io/apiserver/pkg/util/feature" "k8s.io/client-go/tools/record" - featuregatetesting "k8s.io/component-base/featuregate/testing" "k8s.io/component-base/metrics/legacyregistry" "k8s.io/component-base/metrics/testutil" - "k8s.io/kubernetes/pkg/features" kubecontainer "k8s.io/kubernetes/pkg/kubelet/container" "k8s.io/kubernetes/pkg/kubelet/metrics" "k8s.io/kubernetes/pkg/kubelet/util/format" @@ -859,8 +856,6 @@ func TestRunSleepHandler(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.PodLifecycleSleepAction, true) - pod.Spec.Containers[0].Lifecycle.PreStop.Sleep = &v1.SleepAction{Seconds: tt.sleepSeconds} ctx, cancel := context.WithTimeout(context.Background(), time.Duration(tt.terminationGracePeriodSeconds)*time.Second) defer cancel() diff --git a/pkg/registry/core/pod/strategy_test.go b/pkg/registry/core/pod/strategy_test.go index a92c26d9b0b..23471217c7c 100644 --- a/pkg/registry/core/pod/strategy_test.go +++ b/pkg/registry/core/pod/strategy_test.go @@ -2337,6 +2337,7 @@ func TestPodLifecycleSleepActionEnablement(t *testing.T) { for _, tc := range testCases { t.Run(tc.description, func(t *testing.T) { + featuregatetesting.SetFeatureGateEmulationVersionDuringTest(t, utilfeature.DefaultFeatureGate, version.MustParse("1.33")) featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.PodLifecycleSleepAction, tc.gateEnabled) newPod := tc.newPod diff --git a/test/compatibility_lifecycle/reference/versioned_feature_list.yaml b/test/compatibility_lifecycle/reference/versioned_feature_list.yaml index 4ab412e079f..218c378bcb7 100644 --- a/test/compatibility_lifecycle/reference/versioned_feature_list.yaml +++ b/test/compatibility_lifecycle/reference/versioned_feature_list.yaml @@ -1039,6 +1039,10 @@ lockToDefault: false preRelease: Beta version: "1.30" + - default: true + lockToDefault: true + preRelease: GA + version: "1.34" - name: PodLifecycleSleepActionAllowZero versionedSpecs: - default: false diff --git a/test/e2e/feature/feature.go b/test/e2e/feature/feature.go index e4109aea17b..08f065f4889 100644 --- a/test/e2e/feature/feature.go +++ b/test/e2e/feature/feature.go @@ -332,9 +332,6 @@ var ( // PodLevelResources feature gate to be enabled. PodLevelResources = framework.WithFeature(framework.ValidFeatures.Add("PodLevelResources")) - // TODO: document the feature (owning SIG, when to use this feature for a test) - PodLifecycleSleepAction = framework.WithFeature(framework.ValidFeatures.Add("PodLifecycleSleepAction")) - // Owner: sig-node // Marks a single test that tests Pod Lifecycle Sleep action with zero duration. Requires feature gate PodLifecycleSleepActionAllowZero to be enabled. PodLifecycleSleepActionAllowZero = framework.WithFeature(framework.ValidFeatures.Add("PodLifecycleSleepActionAllowZero"))