Update unit tests and feature name
Update the unit tests to include checks for incorrect APIGroup type in PVC DataSource and change the name of the feature gate to be more clear: s/VolumeDataSource/VolumePVCDataSource/
This commit is contained in:
@@ -55,11 +55,15 @@ func dataSourceInUse(oldPVCSpec *core.PersistentVolumeClaimSpec) bool {
|
||||
|
||||
func dataSourceIsEnabled(pvcSpec *core.PersistentVolumeClaimSpec) bool {
|
||||
if pvcSpec.DataSource != nil {
|
||||
if pvcSpec.DataSource.Kind == "PersistentVolumeClaim" && utilfeature.DefaultFeatureGate.Enabled(features.VolumeDataSource) {
|
||||
if pvcSpec.DataSource.Kind == "PersistentVolumeClaim" &&
|
||||
*pvcSpec.DataSource.APIGroup == "" &&
|
||||
utilfeature.DefaultFeatureGate.Enabled(features.VolumePVCDataSource) {
|
||||
return true
|
||||
|
||||
}
|
||||
if pvcSpec.DataSource.Kind == "VolumeSnapshot" && utilfeature.DefaultFeatureGate.Enabled(features.VolumeSnapshotDataSource) {
|
||||
if pvcSpec.DataSource.Kind == "VolumeSnapshot" &&
|
||||
*pvcSpec.DataSource.APIGroup == "snapshot.storage.k8s.io" &&
|
||||
utilfeature.DefaultFeatureGate.Enabled(features.VolumeSnapshotDataSource) {
|
||||
return true
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user