test: remove RetroactiveDefaultStorageClass feature gate
Since the feature is GA and locked to true, tests can no longer set it to false. Cleaning up by removing all references to this feature gate from tests. Feature gate will be removed in v1.29.
This commit is contained in:
parent
97a81a59f6
commit
6afb363ca1
@ -2420,11 +2420,10 @@ func TestValidatePersistentVolumeClaimUpdate(t *testing.T) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
scenarios := map[string]struct {
|
scenarios := map[string]struct {
|
||||||
isExpectedFailure bool
|
isExpectedFailure bool
|
||||||
oldClaim *core.PersistentVolumeClaim
|
oldClaim *core.PersistentVolumeClaim
|
||||||
newClaim *core.PersistentVolumeClaim
|
newClaim *core.PersistentVolumeClaim
|
||||||
enableRecoverFromExpansion bool
|
enableRecoverFromExpansion bool
|
||||||
enableRetroactiveDefaultStorageClass bool
|
|
||||||
}{
|
}{
|
||||||
"valid-update-volumeName-only": {
|
"valid-update-volumeName-only": {
|
||||||
isExpectedFailure: false,
|
isExpectedFailure: false,
|
||||||
@ -2536,67 +2535,34 @@ func TestValidatePersistentVolumeClaimUpdate(t *testing.T) {
|
|||||||
newClaim: validClaimStorageClassInSpec,
|
newClaim: validClaimStorageClassInSpec,
|
||||||
},
|
},
|
||||||
"valid-upgrade-nil-storage-class-spec-to-spec": {
|
"valid-upgrade-nil-storage-class-spec-to-spec": {
|
||||||
isExpectedFailure: false,
|
isExpectedFailure: false,
|
||||||
oldClaim: validClaimStorageClassNil,
|
oldClaim: validClaimStorageClassNil,
|
||||||
newClaim: validClaimStorageClassInSpec,
|
newClaim: validClaimStorageClassInSpec,
|
||||||
enableRetroactiveDefaultStorageClass: true,
|
|
||||||
// Feature enabled - change from nil sc name is valid if there is no beta annotation.
|
|
||||||
},
|
|
||||||
"invalid-upgrade-nil-storage-class-spec-to-spec": {
|
|
||||||
isExpectedFailure: true,
|
|
||||||
oldClaim: validClaimStorageClassNil,
|
|
||||||
newClaim: validClaimStorageClassInSpec,
|
|
||||||
enableRetroactiveDefaultStorageClass: false,
|
|
||||||
// Feature disabled - change from nil sc name is invalid if there is no beta annotation.
|
|
||||||
},
|
},
|
||||||
"invalid-upgrade-not-nil-storage-class-spec-to-spec": {
|
"invalid-upgrade-not-nil-storage-class-spec-to-spec": {
|
||||||
isExpectedFailure: true,
|
isExpectedFailure: true,
|
||||||
oldClaim: validClaimStorageClassInSpec,
|
oldClaim: validClaimStorageClassInSpec,
|
||||||
newClaim: validClaimStorageClassInSpecChanged,
|
newClaim: validClaimStorageClassInSpecChanged,
|
||||||
enableRetroactiveDefaultStorageClass: true,
|
|
||||||
// Feature enablement must not allow non nil value change.
|
|
||||||
},
|
},
|
||||||
"invalid-upgrade-to-nil-storage-class-spec-to-spec": {
|
"invalid-upgrade-to-nil-storage-class-spec-to-spec": {
|
||||||
isExpectedFailure: true,
|
isExpectedFailure: true,
|
||||||
oldClaim: validClaimStorageClassInSpec,
|
oldClaim: validClaimStorageClassInSpec,
|
||||||
newClaim: validClaimStorageClassNil,
|
newClaim: validClaimStorageClassNil,
|
||||||
enableRetroactiveDefaultStorageClass: true,
|
|
||||||
// Feature enablement must not allow change to nil value change.
|
|
||||||
},
|
|
||||||
"valid-upgrade-storage-class-annotation-and-nil-spec-to-spec": {
|
|
||||||
isExpectedFailure: false,
|
|
||||||
oldClaim: validClaimStorageClassInAnnotationAndNilInSpec,
|
|
||||||
newClaim: validClaimStorageClassInAnnotationAndSpec,
|
|
||||||
enableRetroactiveDefaultStorageClass: false,
|
|
||||||
// Change from nil sc name is valid if annotations match.
|
|
||||||
},
|
},
|
||||||
"valid-upgrade-storage-class-annotation-and-nil-spec-to-spec-retro": {
|
"valid-upgrade-storage-class-annotation-and-nil-spec-to-spec-retro": {
|
||||||
isExpectedFailure: false,
|
isExpectedFailure: false,
|
||||||
oldClaim: validClaimStorageClassInAnnotationAndNilInSpec,
|
oldClaim: validClaimStorageClassInAnnotationAndNilInSpec,
|
||||||
newClaim: validClaimStorageClassInAnnotationAndSpec,
|
newClaim: validClaimStorageClassInAnnotationAndSpec,
|
||||||
enableRetroactiveDefaultStorageClass: true,
|
|
||||||
// Change from nil sc name is valid if annotations match, feature enablement must not break this old behavior.
|
|
||||||
},
|
|
||||||
"invalid-upgrade-storage-class-annotation-and-spec-to-spec": {
|
|
||||||
isExpectedFailure: true,
|
|
||||||
oldClaim: validClaimStorageClassInAnnotationAndSpec,
|
|
||||||
newClaim: validClaimStorageClassInSpecChanged,
|
|
||||||
enableRetroactiveDefaultStorageClass: false,
|
|
||||||
// Change from non nil sc name is invalid if annotations don't match.
|
|
||||||
},
|
},
|
||||||
"invalid-upgrade-storage-class-annotation-and-spec-to-spec-retro": {
|
"invalid-upgrade-storage-class-annotation-and-spec-to-spec-retro": {
|
||||||
isExpectedFailure: true,
|
isExpectedFailure: true,
|
||||||
oldClaim: validClaimStorageClassInAnnotationAndSpec,
|
oldClaim: validClaimStorageClassInAnnotationAndSpec,
|
||||||
newClaim: validClaimStorageClassInSpecChanged,
|
newClaim: validClaimStorageClassInSpecChanged,
|
||||||
enableRetroactiveDefaultStorageClass: true,
|
|
||||||
// Change from non nil sc name is invalid if annotations don't match, feature enablement must not break this old behavior.
|
|
||||||
},
|
},
|
||||||
"invalid-upgrade-storage-class-annotation-and-no-spec": {
|
"invalid-upgrade-storage-class-annotation-and-no-spec": {
|
||||||
isExpectedFailure: true,
|
isExpectedFailure: true,
|
||||||
oldClaim: validClaimStorageClassInAnnotationAndNilInSpec,
|
oldClaim: validClaimStorageClassInAnnotationAndNilInSpec,
|
||||||
newClaim: validClaimStorageClassInSpecChanged,
|
newClaim: validClaimStorageClassInSpecChanged,
|
||||||
enableRetroactiveDefaultStorageClass: true,
|
|
||||||
// Change from nil sc name is invalid if annotations don't match, feature enablement must not break this old behavior.
|
|
||||||
},
|
},
|
||||||
"invalid-upgrade-storage-class-annotation-to-spec": {
|
"invalid-upgrade-storage-class-annotation-to-spec": {
|
||||||
isExpectedFailure: true,
|
isExpectedFailure: true,
|
||||||
@ -2662,7 +2628,6 @@ func TestValidatePersistentVolumeClaimUpdate(t *testing.T) {
|
|||||||
for name, scenario := range scenarios {
|
for name, scenario := range scenarios {
|
||||||
t.Run(name, func(t *testing.T) {
|
t.Run(name, func(t *testing.T) {
|
||||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.RecoverVolumeExpansionFailure, scenario.enableRecoverFromExpansion)()
|
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.RecoverVolumeExpansionFailure, scenario.enableRecoverFromExpansion)()
|
||||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.RetroactiveDefaultStorageClass, scenario.enableRetroactiveDefaultStorageClass)()
|
|
||||||
scenario.oldClaim.ResourceVersion = "1"
|
scenario.oldClaim.ResourceVersion = "1"
|
||||||
scenario.newClaim.ResourceVersion = "1"
|
scenario.newClaim.ResourceVersion = "1"
|
||||||
opts := ValidationOptionsForPersistentVolumeClaim(scenario.newClaim, scenario.oldClaim)
|
opts := ValidationOptionsForPersistentVolumeClaim(scenario.newClaim, scenario.oldClaim)
|
||||||
@ -2687,45 +2652,40 @@ func TestValidationOptionsForPersistentVolumeClaim(t *testing.T) {
|
|||||||
oldPvc: nil,
|
oldPvc: nil,
|
||||||
enableReadWriteOncePod: true,
|
enableReadWriteOncePod: true,
|
||||||
expectValidationOpts: PersistentVolumeClaimSpecValidationOptions{
|
expectValidationOpts: PersistentVolumeClaimSpecValidationOptions{
|
||||||
AllowReadWriteOncePod: true,
|
AllowReadWriteOncePod: true,
|
||||||
EnableRecoverFromExpansionFailure: false,
|
EnableRecoverFromExpansionFailure: false,
|
||||||
EnableRetroactiveDefaultStorageClass: true,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"rwop allowed because feature enabled": {
|
"rwop allowed because feature enabled": {
|
||||||
oldPvc: pvcWithAccessModes([]core.PersistentVolumeAccessMode{core.ReadWriteOnce}),
|
oldPvc: pvcWithAccessModes([]core.PersistentVolumeAccessMode{core.ReadWriteOnce}),
|
||||||
enableReadWriteOncePod: true,
|
enableReadWriteOncePod: true,
|
||||||
expectValidationOpts: PersistentVolumeClaimSpecValidationOptions{
|
expectValidationOpts: PersistentVolumeClaimSpecValidationOptions{
|
||||||
AllowReadWriteOncePod: true,
|
AllowReadWriteOncePod: true,
|
||||||
EnableRecoverFromExpansionFailure: false,
|
EnableRecoverFromExpansionFailure: false,
|
||||||
EnableRetroactiveDefaultStorageClass: true,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"rwop not allowed because not used and feature disabled": {
|
"rwop not allowed because not used and feature disabled": {
|
||||||
oldPvc: pvcWithAccessModes([]core.PersistentVolumeAccessMode{core.ReadWriteOnce}),
|
oldPvc: pvcWithAccessModes([]core.PersistentVolumeAccessMode{core.ReadWriteOnce}),
|
||||||
enableReadWriteOncePod: false,
|
enableReadWriteOncePod: false,
|
||||||
expectValidationOpts: PersistentVolumeClaimSpecValidationOptions{
|
expectValidationOpts: PersistentVolumeClaimSpecValidationOptions{
|
||||||
AllowReadWriteOncePod: false,
|
AllowReadWriteOncePod: false,
|
||||||
EnableRecoverFromExpansionFailure: false,
|
EnableRecoverFromExpansionFailure: false,
|
||||||
EnableRetroactiveDefaultStorageClass: true,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"rwop allowed because used and feature enabled": {
|
"rwop allowed because used and feature enabled": {
|
||||||
oldPvc: pvcWithAccessModes([]core.PersistentVolumeAccessMode{core.ReadWriteOncePod}),
|
oldPvc: pvcWithAccessModes([]core.PersistentVolumeAccessMode{core.ReadWriteOncePod}),
|
||||||
enableReadWriteOncePod: true,
|
enableReadWriteOncePod: true,
|
||||||
expectValidationOpts: PersistentVolumeClaimSpecValidationOptions{
|
expectValidationOpts: PersistentVolumeClaimSpecValidationOptions{
|
||||||
AllowReadWriteOncePod: true,
|
AllowReadWriteOncePod: true,
|
||||||
EnableRecoverFromExpansionFailure: false,
|
EnableRecoverFromExpansionFailure: false,
|
||||||
EnableRetroactiveDefaultStorageClass: true,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"rwop allowed because used and feature disabled": {
|
"rwop allowed because used and feature disabled": {
|
||||||
oldPvc: pvcWithAccessModes([]core.PersistentVolumeAccessMode{core.ReadWriteOncePod}),
|
oldPvc: pvcWithAccessModes([]core.PersistentVolumeAccessMode{core.ReadWriteOncePod}),
|
||||||
enableReadWriteOncePod: false,
|
enableReadWriteOncePod: false,
|
||||||
expectValidationOpts: PersistentVolumeClaimSpecValidationOptions{
|
expectValidationOpts: PersistentVolumeClaimSpecValidationOptions{
|
||||||
AllowReadWriteOncePod: true,
|
AllowReadWriteOncePod: true,
|
||||||
EnableRecoverFromExpansionFailure: false,
|
EnableRecoverFromExpansionFailure: false,
|
||||||
EnableRetroactiveDefaultStorageClass: true,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -754,8 +754,6 @@ func TestModifyDeletionFinalizers(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRetroactiveStorageClassAssignment(t *testing.T) {
|
func TestRetroactiveStorageClassAssignment(t *testing.T) {
|
||||||
// Enable RetroactiveDefaultStorageClass feature gate.
|
|
||||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.RetroactiveDefaultStorageClass, true)()
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
storageClasses []*storagev1.StorageClass
|
storageClasses []*storagev1.StorageClass
|
||||||
tests []controllerTest
|
tests []controllerTest
|
||||||
|
@ -19,9 +19,6 @@ package volume
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
|
||||||
featuregatetesting "k8s.io/component-base/featuregate/testing"
|
|
||||||
"k8s.io/kubernetes/pkg/features"
|
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
@ -1045,7 +1042,6 @@ func TestPersistentVolumeMultiPVsDiffAccessModes(t *testing.T) {
|
|||||||
// assignment and binding of PVCs with storage class name set to nil or "" with
|
// assignment and binding of PVCs with storage class name set to nil or "" with
|
||||||
// and without presence of a default SC.
|
// and without presence of a default SC.
|
||||||
func TestRetroactiveStorageClassAssignment(t *testing.T) {
|
func TestRetroactiveStorageClassAssignment(t *testing.T) {
|
||||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.RetroactiveDefaultStorageClass, true)()
|
|
||||||
s := kubeapiservertesting.StartTestServerOrDie(t, nil, []string{"--disable-admission-plugins=DefaultStorageClass"}, framework.SharedEtcd())
|
s := kubeapiservertesting.StartTestServerOrDie(t, nil, []string{"--disable-admission-plugins=DefaultStorageClass"}, framework.SharedEtcd())
|
||||||
defer s.TearDownFn()
|
defer s.TearDownFn()
|
||||||
namespaceName := "retro-pvc-sc"
|
namespaceName := "retro-pvc-sc"
|
||||||
|
Loading…
Reference in New Issue
Block a user