Add a new field for storing volume expansion secrets

Fix pv secret visitor tests
Allow SecretRef for resizing to be set if not already set
This commit is contained in:
Hemant Kumar
2019-05-06 11:49:19 -04:00
parent 851afa0bea
commit 69393291b6
15 changed files with 1798 additions and 1535 deletions

View File

@@ -28,6 +28,23 @@ func DropDisabledFields(pvSpec *api.PersistentVolumeSpec, oldPVSpec *api.Persist
if !utilfeature.DefaultFeatureGate.Enabled(features.BlockVolume) && !volumeModeInUse(oldPVSpec) {
pvSpec.VolumeMode = nil
}
if !utilfeature.DefaultFeatureGate.Enabled(features.ExpandCSIVolumes) && !hasExpansionSecrets(oldPVSpec) {
if pvSpec.CSI != nil {
pvSpec.CSI.ControllerExpandSecretRef = nil
}
}
}
func hasExpansionSecrets(oldPVSpec *api.PersistentVolumeSpec) bool {
if oldPVSpec == nil || oldPVSpec.CSI == nil {
return false
}
if oldPVSpec.CSI.ControllerExpandSecretRef != nil {
return true
}
return false
}
func volumeModeInUse(oldPVSpec *api.PersistentVolumeSpec) bool {