mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 21:47:07 +00:00
Merge pull request #130621 from sreeram-venkitesh/4818-sleep-action-zero-value-beta-graduation
KEP 4818: PodLifecycleSleepActionAllowZero to Beta
This commit is contained in:
commit
2546557012
@ -4114,12 +4114,14 @@ func TestValidateAllowPodLifecycleSleepActionZeroValue(t *testing.T) {
|
|||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
name string
|
name string
|
||||||
podSpec *api.PodSpec
|
podSpec *api.PodSpec
|
||||||
|
featureEnabled bool
|
||||||
expectAllowPodLifecycleSleepActionZeroValue bool
|
expectAllowPodLifecycleSleepActionZeroValue bool
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "no lifecycle hooks",
|
name: "no lifecycle hooks",
|
||||||
podSpec: &api.PodSpec{},
|
podSpec: &api.PodSpec{},
|
||||||
expectAllowPodLifecycleSleepActionZeroValue: false,
|
featureEnabled: true,
|
||||||
|
expectAllowPodLifecycleSleepActionZeroValue: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Prestop with non-zero second duration",
|
name: "Prestop with non-zero second duration",
|
||||||
@ -4136,7 +4138,8 @@ func TestValidateAllowPodLifecycleSleepActionZeroValue(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
expectAllowPodLifecycleSleepActionZeroValue: false,
|
featureEnabled: true,
|
||||||
|
expectAllowPodLifecycleSleepActionZeroValue: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "PostStart with non-zero second duration",
|
name: "PostStart with non-zero second duration",
|
||||||
@ -4153,7 +4156,8 @@ func TestValidateAllowPodLifecycleSleepActionZeroValue(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
expectAllowPodLifecycleSleepActionZeroValue: false,
|
featureEnabled: true,
|
||||||
|
expectAllowPodLifecycleSleepActionZeroValue: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "PreStop with zero seconds",
|
name: "PreStop with zero seconds",
|
||||||
@ -4170,6 +4174,7 @@ func TestValidateAllowPodLifecycleSleepActionZeroValue(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
featureEnabled: true,
|
||||||
expectAllowPodLifecycleSleepActionZeroValue: true,
|
expectAllowPodLifecycleSleepActionZeroValue: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -4187,12 +4192,93 @@ func TestValidateAllowPodLifecycleSleepActionZeroValue(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
featureEnabled: true,
|
||||||
|
expectAllowPodLifecycleSleepActionZeroValue: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "no lifecycle hooks with feature gate disabled",
|
||||||
|
podSpec: &api.PodSpec{},
|
||||||
|
featureEnabled: false,
|
||||||
|
expectAllowPodLifecycleSleepActionZeroValue: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Prestop with non-zero second duration with feature gate disabled",
|
||||||
|
podSpec: &api.PodSpec{
|
||||||
|
Containers: []api.Container{
|
||||||
|
{
|
||||||
|
Lifecycle: &api.Lifecycle{
|
||||||
|
PreStop: &api.LifecycleHandler{
|
||||||
|
Sleep: &api.SleepAction{
|
||||||
|
Seconds: 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
featureEnabled: false,
|
||||||
|
expectAllowPodLifecycleSleepActionZeroValue: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "PostStart with non-zero second duration with feature gate disabled",
|
||||||
|
podSpec: &api.PodSpec{
|
||||||
|
Containers: []api.Container{
|
||||||
|
{
|
||||||
|
Lifecycle: &api.Lifecycle{
|
||||||
|
PostStart: &api.LifecycleHandler{
|
||||||
|
Sleep: &api.SleepAction{
|
||||||
|
Seconds: 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
featureEnabled: false,
|
||||||
|
expectAllowPodLifecycleSleepActionZeroValue: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "PreStop with zero seconds with feature gate disabled",
|
||||||
|
podSpec: &api.PodSpec{
|
||||||
|
Containers: []api.Container{
|
||||||
|
{
|
||||||
|
Lifecycle: &api.Lifecycle{
|
||||||
|
PreStop: &api.LifecycleHandler{
|
||||||
|
Sleep: &api.SleepAction{
|
||||||
|
Seconds: 0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
featureEnabled: false,
|
||||||
|
expectAllowPodLifecycleSleepActionZeroValue: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "PostStart with zero seconds with feature gate disabled",
|
||||||
|
podSpec: &api.PodSpec{
|
||||||
|
Containers: []api.Container{
|
||||||
|
{
|
||||||
|
Lifecycle: &api.Lifecycle{
|
||||||
|
PostStart: &api.LifecycleHandler{
|
||||||
|
Sleep: &api.SleepAction{
|
||||||
|
Seconds: 0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
featureEnabled: false,
|
||||||
expectAllowPodLifecycleSleepActionZeroValue: true,
|
expectAllowPodLifecycleSleepActionZeroValue: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
|
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.PodLifecycleSleepActionAllowZero, tc.featureEnabled)
|
||||||
|
|
||||||
gotOptions := GetValidationOptionsFromPodSpecAndMeta(&api.PodSpec{}, tc.podSpec, nil, nil)
|
gotOptions := GetValidationOptionsFromPodSpecAndMeta(&api.PodSpec{}, tc.podSpec, nil, nil)
|
||||||
assert.Equal(t, tc.expectAllowPodLifecycleSleepActionZeroValue, gotOptions.AllowPodLifecycleSleepActionZeroValue, "AllowPodLifecycleSleepActionZeroValue")
|
assert.Equal(t, tc.expectAllowPodLifecycleSleepActionZeroValue, gotOptions.AllowPodLifecycleSleepActionZeroValue, "AllowPodLifecycleSleepActionZeroValue")
|
||||||
})
|
})
|
||||||
|
@ -1558,6 +1558,7 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate
|
|||||||
|
|
||||||
PodLifecycleSleepActionAllowZero: {
|
PodLifecycleSleepActionAllowZero: {
|
||||||
{Version: version.MustParse("1.32"), Default: false, PreRelease: featuregate.Alpha},
|
{Version: version.MustParse("1.32"), Default: false, PreRelease: featuregate.Alpha},
|
||||||
|
{Version: version.MustParse("1.33"), Default: true, PreRelease: featuregate.Beta},
|
||||||
},
|
},
|
||||||
|
|
||||||
PodObservedGenerationTracking: {
|
PodObservedGenerationTracking: {
|
||||||
|
@ -1035,6 +1035,10 @@
|
|||||||
lockToDefault: false
|
lockToDefault: false
|
||||||
preRelease: Alpha
|
preRelease: Alpha
|
||||||
version: "1.32"
|
version: "1.32"
|
||||||
|
- default: true
|
||||||
|
lockToDefault: false
|
||||||
|
preRelease: Beta
|
||||||
|
version: "1.33"
|
||||||
- name: PodLogsQuerySplitStreams
|
- name: PodLogsQuerySplitStreams
|
||||||
versionedSpecs:
|
versionedSpecs:
|
||||||
- default: false
|
- default: false
|
||||||
|
Loading…
Reference in New Issue
Block a user