From 21c832b47dc5b2454f14cbfcc7c74ce6efbeb851 Mon Sep 17 00:00:00 2001 From: Natasha Sarkar Date: Wed, 29 Oct 2025 15:50:17 +0000 Subject: [PATCH 1/2] promote pod generation to GA --- pkg/features/kube_features.go | 1 + .../reference/versioned_feature_list.yaml | 4 ++++ test/e2e/feature/feature.go | 4 ---- test/e2e/node/pods.go | 3 +-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/features/kube_features.go b/pkg/features/kube_features.go index 4161d2b82b9..69eb9bea211 100644 --- a/pkg/features/kube_features.go +++ b/pkg/features/kube_features.go @@ -1507,6 +1507,7 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate PodObservedGenerationTracking: { {Version: version.MustParse("1.33"), Default: false, PreRelease: featuregate.Alpha}, {Version: version.MustParse("1.34"), Default: true, PreRelease: featuregate.Beta}, + {Version: version.MustParse("1.35"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // GA in 1.35, remove in 1.38 }, PodReadyToStartContainersCondition: { diff --git a/test/compatibility_lifecycle/reference/versioned_feature_list.yaml b/test/compatibility_lifecycle/reference/versioned_feature_list.yaml index 041d6b28197..a02ded9d3b4 100644 --- a/test/compatibility_lifecycle/reference/versioned_feature_list.yaml +++ b/test/compatibility_lifecycle/reference/versioned_feature_list.yaml @@ -1189,6 +1189,10 @@ lockToDefault: false preRelease: Beta version: "1.34" + - default: true + lockToDefault: true + preRelease: GA + version: "1.35" - name: PodReadyToStartContainersCondition versionedSpecs: - default: false diff --git a/test/e2e/feature/feature.go b/test/e2e/feature/feature.go index d96ccafd800..6e5a422f630 100644 --- a/test/e2e/feature/feature.go +++ b/test/e2e/feature/feature.go @@ -333,10 +333,6 @@ var ( // (used for testing specific log stream ) PodLogsQuerySplitStreams = framework.WithFeature(framework.ValidFeatures.Add("PodLogsQuerySplitStreams")) - // Owner: sig-node - // Marks tests that require a cluster with PodObservedGenerationTracking - PodObservedGenerationTracking = framework.WithFeature(framework.ValidFeatures.Add("PodObservedGenerationTracking")) - // TODO: document the feature (owning SIG, when to use this feature for a test) PodPriority = framework.WithFeature(framework.ValidFeatures.Add("PodPriority")) diff --git a/test/e2e/node/pods.go b/test/e2e/node/pods.go index fad2545c199..3a464a99bc3 100644 --- a/test/e2e/node/pods.go +++ b/test/e2e/node/pods.go @@ -41,7 +41,6 @@ import ( "k8s.io/client-go/util/retry" "k8s.io/kubernetes/pkg/features" "k8s.io/kubernetes/pkg/kubelet/events" - "k8s.io/kubernetes/test/e2e/feature" "k8s.io/kubernetes/test/e2e/framework" e2ekubelet "k8s.io/kubernetes/test/e2e/framework/kubelet" e2enode "k8s.io/kubernetes/test/e2e/framework/node" @@ -420,7 +419,7 @@ var _ = SIGDescribe("Pods Extended", func() { }) }) -var _ = SIGDescribe("Pods Extended (pod generation)", feature.PodObservedGenerationTracking, framework.WithFeatureGate(features.PodObservedGenerationTracking), func() { +var _ = SIGDescribe("Pods Extended (pod generation)", framework.WithFeatureGate(features.PodObservedGenerationTracking), func() { f := framework.NewDefaultFramework("pods") f.NamespacePodSecurityLevel = admissionapi.LevelBaseline From 4a991bbbd9c2e6866af4633d9c7656494833fa82 Mon Sep 17 00:00:00 2001 From: Natasha Sarkar Date: Wed, 29 Oct 2025 16:34:18 +0000 Subject: [PATCH 2/2] fix unit tests for pod gen GA --- pkg/api/pod/util_test.go | 50 ---------------------- pkg/api/v1/pod/util_test.go | 82 ------------------------------------- 2 files changed, 132 deletions(-) diff --git a/pkg/api/pod/util_test.go b/pkg/api/pod/util_test.go index 1aa4d65377b..286c4e2ec8c 100644 --- a/pkg/api/pod/util_test.go +++ b/pkg/api/pod/util_test.go @@ -1234,97 +1234,47 @@ func TestDropDisabledPodStatusFields_ObservedGeneration(t *testing.T) { name string podStatus *api.PodStatus oldPodStatus *api.PodStatus - featureGateOn bool wantPodStatus *api.PodStatus }{ - { - name: "old=without, new=without / feature gate off", - oldPodStatus: podWithoutObservedGen(), - podStatus: podWithoutObservedGen(), - featureGateOn: false, - wantPodStatus: podWithoutObservedGen(), - }, { name: "old=without, new=without / feature gate on", oldPodStatus: podWithoutObservedGen(), podStatus: podWithoutObservedGen(), - featureGateOn: true, - wantPodStatus: podWithoutObservedGen(), - }, - { - name: "old=without, new=with / feature gate off", - oldPodStatus: podWithoutObservedGen(), - podStatus: podWithObservedGen(), - featureGateOn: false, wantPodStatus: podWithoutObservedGen(), }, { name: "old=with, new=without / feature gate on", oldPodStatus: podWithObservedGen(), podStatus: podWithoutObservedGen(), - featureGateOn: true, wantPodStatus: podWithoutObservedGen(), }, - { - name: "old=with, new=with / feature gate off", - oldPodStatus: podWithObservedGen(), - podStatus: podWithObservedGen(), - featureGateOn: false, - wantPodStatus: podWithObservedGen(), - }, { name: "old=with, new=with / feature gate on", oldPodStatus: podWithObservedGen(), podStatus: podWithObservedGen(), - featureGateOn: true, wantPodStatus: podWithObservedGen(), }, - { - name: "old=without, new=withInConditions / feature gate off", - oldPodStatus: podWithoutObservedGen(), - podStatus: podWithObservedGenInConditions(), - featureGateOn: false, - wantPodStatus: podWithoutObservedGen(), - }, { name: "old=without, new=withInConditions / feature gate on", oldPodStatus: podWithoutObservedGen(), podStatus: podWithObservedGenInConditions(), - featureGateOn: true, wantPodStatus: podWithObservedGenInConditions(), }, - { - name: "old=withInConditions, new=without / feature gate off", - oldPodStatus: podWithObservedGenInConditions(), - podStatus: podWithoutObservedGen(), - featureGateOn: false, - wantPodStatus: podWithoutObservedGen(), - }, { name: "old=withInConditions, new=without / feature gate on", oldPodStatus: podWithObservedGenInConditions(), podStatus: podWithoutObservedGen(), - featureGateOn: true, wantPodStatus: podWithoutObservedGen(), }, - { - name: "old=withInConditions, new=withInCondtions / feature gate off", - oldPodStatus: podWithObservedGenInConditions(), - podStatus: podWithObservedGenInConditions(), - featureGateOn: false, - wantPodStatus: podWithObservedGenInConditions(), - }, { name: "old=withInConditions, new=withInCondtions / feature gate on", oldPodStatus: podWithObservedGenInConditions(), podStatus: podWithObservedGenInConditions(), - featureGateOn: true, wantPodStatus: podWithObservedGenInConditions(), }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.PodObservedGenerationTracking, tt.featureGateOn) dropDisabledPodStatusFields(tt.podStatus, tt.oldPodStatus, &api.PodSpec{}, &api.PodSpec{}) if !reflect.DeepEqual(tt.podStatus, tt.wantPodStatus) { t.Errorf("dropDisabledStatusFields() = %v, want %v", tt.podStatus, tt.wantPodStatus) diff --git a/pkg/api/v1/pod/util_test.go b/pkg/api/v1/pod/util_test.go index 7e2d08439f4..8013300ec0a 100644 --- a/pkg/api/v1/pod/util_test.go +++ b/pkg/api/v1/pod/util_test.go @@ -28,10 +28,6 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/validation/field" - utilfeature "k8s.io/apiserver/pkg/util/feature" - "k8s.io/component-base/featuregate" - featuregatetesting "k8s.io/component-base/featuregate/testing" - "k8s.io/kubernetes/pkg/features" ) func TestVisitContainers(t *testing.T) { @@ -1015,21 +1011,8 @@ func TestCalculatePodStatusObservedGeneration(t *testing.T) { tests := []struct { name string pod *v1.Pod - features map[featuregate.Feature]bool expected int64 }{ - { - name: "pod with no observedGeneration/PodObservedGenerationTracking=false", - pod: &v1.Pod{ - ObjectMeta: metav1.ObjectMeta{ - Generation: 5, - }, - }, - features: map[featuregate.Feature]bool{ - features.PodObservedGenerationTracking: false, - }, - expected: 0, - }, { name: "pod with no observedGeneration/PodObservedGenerationTracking=true", pod: &v1.Pod{ @@ -1037,24 +1020,6 @@ func TestCalculatePodStatusObservedGeneration(t *testing.T) { Generation: 5, }, }, - features: map[featuregate.Feature]bool{ - features.PodObservedGenerationTracking: true, - }, - expected: 5, - }, - { - name: "pod with observedGeneration/PodObservedGenerationTracking=false", - pod: &v1.Pod{ - ObjectMeta: metav1.ObjectMeta{ - Generation: 5, - }, - Status: v1.PodStatus{ - ObservedGeneration: 5, - }, - }, - features: map[featuregate.Feature]bool{ - features.PodObservedGenerationTracking: false, - }, expected: 5, }, { @@ -1067,16 +1032,12 @@ func TestCalculatePodStatusObservedGeneration(t *testing.T) { ObservedGeneration: 5, }, }, - features: map[featuregate.Feature]bool{ - features.PodObservedGenerationTracking: true, - }, expected: 5, }, } for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { - featuregatetesting.SetFeatureGatesDuringTest(t, utilfeature.DefaultFeatureGate, tc.features) assert.Equal(t, tc.expected, CalculatePodStatusObservedGeneration(tc.pod)) }) } @@ -1086,26 +1047,8 @@ func TestCalculatePodConditionObservedGeneration(t *testing.T) { tests := []struct { name string pod *v1.Pod - features map[featuregate.Feature]bool expected int64 }{ - { - name: "pod with no observedGeneration/PodObservedGenerationTracking=false", - pod: &v1.Pod{ - ObjectMeta: metav1.ObjectMeta{ - Generation: 5, - }, - Status: v1.PodStatus{ - Conditions: []v1.PodCondition{{ - Type: v1.PodReady, - }}, - }, - }, - features: map[featuregate.Feature]bool{ - features.PodObservedGenerationTracking: false, - }, - expected: 0, - }, { name: "pod with no observedGeneration/PodObservedGenerationTracking=true", pod: &v1.Pod{ @@ -1118,27 +1061,6 @@ func TestCalculatePodConditionObservedGeneration(t *testing.T) { }}, }, }, - features: map[featuregate.Feature]bool{ - features.PodObservedGenerationTracking: true, - }, - expected: 5, - }, - { - name: "pod with observedGeneration/PodObservedGenerationTracking=false", - pod: &v1.Pod{ - ObjectMeta: metav1.ObjectMeta{ - Generation: 5, - }, - Status: v1.PodStatus{ - Conditions: []v1.PodCondition{{ - Type: v1.PodReady, - ObservedGeneration: 5, - }}, - }, - }, - features: map[featuregate.Feature]bool{ - features.PodObservedGenerationTracking: false, - }, expected: 5, }, { @@ -1154,16 +1076,12 @@ func TestCalculatePodConditionObservedGeneration(t *testing.T) { }}, }, }, - features: map[featuregate.Feature]bool{ - features.PodObservedGenerationTracking: true, - }, expected: 5, }, } for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { - featuregatetesting.SetFeatureGatesDuringTest(t, utilfeature.DefaultFeatureGate, tc.features) assert.Equal(t, tc.expected, CalculatePodConditionObservedGeneration(&tc.pod.Status, tc.pod.Generation, v1.PodReady)) }) }