mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-22 10:27:56 +00:00
Rename DropDisabledAlphaFields to DropDisabledFields
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
@@ -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")
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user