Merge pull request #80099 from dims/add-warnings-for-cinder-and-scale-io-volume-providers

Add explicit warning for deprecation of Cinder and ScaleIO volume providers
This commit is contained in:
Kubernetes Prow Robot 2019-07-12 16:47:17 -07:00 committed by GitHub
commit 844a0c9a10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -66,6 +66,13 @@ const (
CSIVolumePublished CSIVolumePhaseType = "published" CSIVolumePublished CSIVolumePhaseType = "published"
) )
var (
deprecatedVolumeProviders = map[string]string{
"kubernetes.io/cinder": "The Cinder volume provider is deprecated and will be removed in a future release",
"kubernetes.io/scaleio": "The ScaleIO volume provider is deprecated and will be removed in a future release",
}
)
// VolumeOptions contains option information about a volume. // VolumeOptions contains option information about a volume.
type VolumeOptions struct { type VolumeOptions struct {
// The attributes below are required by volume.Provisioner // The attributes below are required by volume.Provisioner
@ -674,6 +681,11 @@ func (pm *VolumePluginMgr) FindPluginBySpec(spec *Spec) (VolumePlugin, error) {
} }
return nil, fmt.Errorf("multiple volume plugins matched: %s", strings.Join(matchedPluginNames, ",")) return nil, fmt.Errorf("multiple volume plugins matched: %s", strings.Join(matchedPluginNames, ","))
} }
// Issue warning if the matched provider is deprecated
if detail, ok := deprecatedVolumeProviders[matches[0].GetPluginName()]; ok {
klog.Warningf("WARNING: %s built-in volume provider is now deprecated. %s", matches[0].GetPluginName(), detail)
}
return matches[0], nil return matches[0], nil
} }
@ -737,6 +749,11 @@ func (pm *VolumePluginMgr) FindPluginByName(name string) (VolumePlugin, error) {
} }
return nil, fmt.Errorf("multiple volume plugins matched: %s", strings.Join(matchedPluginNames, ",")) return nil, fmt.Errorf("multiple volume plugins matched: %s", strings.Join(matchedPluginNames, ","))
} }
// Issue warning if the matched provider is deprecated
if detail, ok := deprecatedVolumeProviders[matches[0].GetPluginName()]; ok {
klog.Warningf("WARNING: %s built-in volume provider is now deprecated. %s", matches[0].GetPluginName(), detail)
}
return matches[0], nil return matches[0], nil
} }