mirror of
https://github.com/kubernetes/kubernetes.git
synced 2026-05-28 04:04:39 -04:00
Merge pull request #134948 from natasha41575/podgeneration-ga
Promote Pod Generation to GA
This commit is contained in:
commit
a490c43f0e
6 changed files with 6 additions and 138 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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: {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -333,10 +333,6 @@ var (
|
|||
// (used for testing specific log stream <https://kep.k8s.io/3288>)
|
||||
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"))
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue