Rename DropDisabledAlphaFields to DropDisabledFields

This commit is contained in:
Jordan Liggitt
2018-12-18 17:45:37 -05:00
parent 9f40607ea7
commit 88284f637b
9 changed files with 23 additions and 23 deletions

View File

@@ -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
}

View File

@@ -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")
}
}