From 88284f637b27543c3567deac8a22d398701995fa Mon Sep 17 00:00:00 2001 From: Jordan Liggitt Date: Tue, 18 Dec 2018 17:45:37 -0500 Subject: [PATCH] Rename DropDisabledAlphaFields to DropDisabledFields --- pkg/api/persistentvolumeclaim/util.go | 4 ++-- pkg/api/persistentvolumeclaim/util_test.go | 6 +++--- pkg/api/podsecuritypolicy/util.go | 4 ++-- pkg/api/podsecuritypolicy/util_test.go | 6 +++--- pkg/apis/storage/util/util.go | 4 ++-- pkg/apis/storage/util/util_test.go | 4 ++-- pkg/registry/core/persistentvolumeclaim/strategy.go | 6 +++--- pkg/registry/policy/podsecuritypolicy/strategy.go | 6 +++--- pkg/registry/storage/storageclass/strategy.go | 6 +++--- 9 files changed, 23 insertions(+), 23 deletions(-) diff --git a/pkg/api/persistentvolumeclaim/util.go b/pkg/api/persistentvolumeclaim/util.go index a6321d3404..b513418a5a 100644 --- a/pkg/api/persistentvolumeclaim/util.go +++ b/pkg/api/persistentvolumeclaim/util.go @@ -22,9 +22,9 @@ import ( "k8s.io/kubernetes/pkg/features" ) -// DropDisabledAlphaFields removes disabled fields from the pvc spec. +// DropDisabledFields removes disabled fields from the pvc spec. // This should be called from PrepareForCreate/PrepareForUpdate for all resources containing a pvc spec. -func DropDisabledAlphaFields(pvcSpec *core.PersistentVolumeClaimSpec) { +func DropDisabledFields(pvcSpec *core.PersistentVolumeClaimSpec) { if !utilfeature.DefaultFeatureGate.Enabled(features.BlockVolume) { pvcSpec.VolumeMode = nil } diff --git a/pkg/api/persistentvolumeclaim/util_test.go b/pkg/api/persistentvolumeclaim/util_test.go index 7bb61edd1d..8b10ba040a 100644 --- a/pkg/api/persistentvolumeclaim/util_test.go +++ b/pkg/api/persistentvolumeclaim/util_test.go @@ -39,7 +39,7 @@ func TestDropAlphaPVCVolumeMode(t *testing.T) { // Enable alpha feature BlockVolume defer utilfeaturetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.BlockVolume, true)() // now test dropping the fields - should not be dropped - DropDisabledAlphaFields(&pvc.Spec) + DropDisabledFields(&pvc.Spec) // check to make sure VolumeDevices is still present // if featureset is set to true @@ -50,11 +50,11 @@ func TestDropAlphaPVCVolumeMode(t *testing.T) { // Disable alpha feature BlockVolume defer utilfeaturetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.BlockVolume, false)() // now test dropping the fields - DropDisabledAlphaFields(&pvc.Spec) + DropDisabledFields(&pvc.Spec) // check to make sure VolumeDevices is nil // if featureset is set to false if pvc.Spec.VolumeMode != nil { - t.Error("DropDisabledAlphaFields VolumeMode for pvc.Spec failed") + t.Error("DropDisabledFields VolumeMode for pvc.Spec failed") } } diff --git a/pkg/api/podsecuritypolicy/util.go b/pkg/api/podsecuritypolicy/util.go index 8c1f351181..ba1ac1b89f 100644 --- a/pkg/api/podsecuritypolicy/util.go +++ b/pkg/api/podsecuritypolicy/util.go @@ -22,9 +22,9 @@ import ( "k8s.io/kubernetes/pkg/features" ) -// DropDisabledAlphaFields removes disabled fields from the pod security policy spec. +// DropDisabledFields removes disabled fields from the pod security policy spec. // This should be called from PrepareForCreate/PrepareForUpdate for all resources containing a od security policy spec. -func DropDisabledAlphaFields(pspSpec *policy.PodSecurityPolicySpec) { +func DropDisabledFields(pspSpec *policy.PodSecurityPolicySpec) { if !utilfeature.DefaultFeatureGate.Enabled(features.ProcMountType) { pspSpec.AllowedProcMountTypes = nil } diff --git a/pkg/api/podsecuritypolicy/util_test.go b/pkg/api/podsecuritypolicy/util_test.go index 5fe4e52662..dd361c1b7e 100644 --- a/pkg/api/podsecuritypolicy/util_test.go +++ b/pkg/api/podsecuritypolicy/util_test.go @@ -38,7 +38,7 @@ func TestDropAlphaProcMountType(t *testing.T) { defer utilfeaturetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.ProcMountType, true)() // now test dropping the fields - should not be dropped - DropDisabledAlphaFields(&psp.Spec) + DropDisabledFields(&psp.Spec) // check to make sure AllowedProcMountTypes is still present // if featureset is set to true @@ -52,13 +52,13 @@ func TestDropAlphaProcMountType(t *testing.T) { defer utilfeaturetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.ProcMountType, false)() // now test dropping the fields - DropDisabledAlphaFields(&psp.Spec) + DropDisabledFields(&psp.Spec) // check to make sure AllowedProcMountTypes is nil // if featureset is set to false if utilfeature.DefaultFeatureGate.Enabled(features.ProcMountType) { if psp.Spec.AllowedProcMountTypes != nil { - t.Error("DropDisabledAlphaFields AllowedProcMountTypes for psp.Spec failed") + t.Error("DropDisabledFields AllowedProcMountTypes for psp.Spec failed") } } } diff --git a/pkg/apis/storage/util/util.go b/pkg/apis/storage/util/util.go index 382802d964..9019f9d956 100644 --- a/pkg/apis/storage/util/util.go +++ b/pkg/apis/storage/util/util.go @@ -22,8 +22,8 @@ import ( "k8s.io/kubernetes/pkg/features" ) -// DropDisabledAlphaFields removes disabled fields from the StorageClass object. -func DropDisabledAlphaFields(class *storage.StorageClass) { +// DropDisabledFields removes disabled fields from the StorageClass object. +func DropDisabledFields(class *storage.StorageClass) { if !utilfeature.DefaultFeatureGate.Enabled(features.VolumeScheduling) { class.VolumeBindingMode = nil class.AllowedTopologies = nil diff --git a/pkg/apis/storage/util/util_test.go b/pkg/apis/storage/util/util_test.go index d2cf140210..7353417f68 100644 --- a/pkg/apis/storage/util/util_test.go +++ b/pkg/apis/storage/util/util_test.go @@ -46,7 +46,7 @@ func TestDropAlphaFields(t *testing.T) { VolumeBindingMode: &bindingMode, AllowedTopologies: allowedTopologies, } - DropDisabledAlphaFields(class) + DropDisabledFields(class) if class.VolumeBindingMode != nil { t.Errorf("VolumeBindingMode field didn't get dropped: %+v", class.VolumeBindingMode) } @@ -60,7 +60,7 @@ func TestDropAlphaFields(t *testing.T) { AllowedTopologies: allowedTopologies, } defer utilfeaturetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.VolumeScheduling, true)() - DropDisabledAlphaFields(class) + DropDisabledFields(class) if class.VolumeBindingMode != &bindingMode { t.Errorf("VolumeBindingMode field got unexpectantly modified: %+v", class.VolumeBindingMode) } diff --git a/pkg/registry/core/persistentvolumeclaim/strategy.go b/pkg/registry/core/persistentvolumeclaim/strategy.go index abefe0de11..c8efa085f6 100644 --- a/pkg/registry/core/persistentvolumeclaim/strategy.go +++ b/pkg/registry/core/persistentvolumeclaim/strategy.go @@ -52,7 +52,7 @@ func (persistentvolumeclaimStrategy) PrepareForCreate(ctx context.Context, obj r pvc := obj.(*api.PersistentVolumeClaim) pvc.Status = api.PersistentVolumeClaimStatus{} - pvcutil.DropDisabledAlphaFields(&pvc.Spec) + pvcutil.DropDisabledFields(&pvc.Spec) } func (persistentvolumeclaimStrategy) Validate(ctx context.Context, obj runtime.Object) field.ErrorList { @@ -74,8 +74,8 @@ func (persistentvolumeclaimStrategy) PrepareForUpdate(ctx context.Context, obj, oldPvc := old.(*api.PersistentVolumeClaim) newPvc.Status = oldPvc.Status - pvcutil.DropDisabledAlphaFields(&newPvc.Spec) - pvcutil.DropDisabledAlphaFields(&oldPvc.Spec) + pvcutil.DropDisabledFields(&newPvc.Spec) + pvcutil.DropDisabledFields(&oldPvc.Spec) } func (persistentvolumeclaimStrategy) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { diff --git a/pkg/registry/policy/podsecuritypolicy/strategy.go b/pkg/registry/policy/podsecuritypolicy/strategy.go index c9940fe2d8..e253c2e9da 100644 --- a/pkg/registry/policy/podsecuritypolicy/strategy.go +++ b/pkg/registry/policy/podsecuritypolicy/strategy.go @@ -58,15 +58,15 @@ func (strategy) AllowUnconditionalUpdate() bool { func (strategy) PrepareForCreate(ctx context.Context, obj runtime.Object) { psp := obj.(*policy.PodSecurityPolicy) - psputil.DropDisabledAlphaFields(&psp.Spec) + psputil.DropDisabledFields(&psp.Spec) } func (strategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { newPsp := obj.(*policy.PodSecurityPolicy) oldPsp := old.(*policy.PodSecurityPolicy) - psputil.DropDisabledAlphaFields(&newPsp.Spec) - psputil.DropDisabledAlphaFields(&oldPsp.Spec) + psputil.DropDisabledFields(&newPsp.Spec) + psputil.DropDisabledFields(&oldPsp.Spec) } func (strategy) Canonicalize(obj runtime.Object) { diff --git a/pkg/registry/storage/storageclass/strategy.go b/pkg/registry/storage/storageclass/strategy.go index b570d39e23..88b17132ed 100644 --- a/pkg/registry/storage/storageclass/strategy.go +++ b/pkg/registry/storage/storageclass/strategy.go @@ -52,7 +52,7 @@ func (storageClassStrategy) PrepareForCreate(ctx context.Context, obj runtime.Ob class.AllowVolumeExpansion = nil } - storageutil.DropDisabledAlphaFields(class) + storageutil.DropDisabledFields(class) } func (storageClassStrategy) Validate(ctx context.Context, obj runtime.Object) field.ErrorList { @@ -77,8 +77,8 @@ func (storageClassStrategy) PrepareForUpdate(ctx context.Context, obj, old runti newClass.AllowVolumeExpansion = nil oldClass.AllowVolumeExpansion = nil } - storageutil.DropDisabledAlphaFields(oldClass) - storageutil.DropDisabledAlphaFields(newClass) + storageutil.DropDisabledFields(oldClass) + storageutil.DropDisabledFields(newClass) } func (storageClassStrategy) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList {