fix openstack provider to handle only Cinder volumes

When the cloud-controller-manager is running with PV label initializing controller
and NFS volume is created, it causes nill reference error.

related to #68996
This commit is contained in:
Martin Vladev 2018-10-31 01:57:40 +02:00
parent 59625d8788
commit 3b0ddbf07e

View File

@ -697,6 +697,11 @@ func (os *OpenStack) ShouldTrustDevicePath() bool {
// GetLabelsForVolume implements PVLabeler.GetLabelsForVolume
func (os *OpenStack) GetLabelsForVolume(ctx context.Context, pv *v1.PersistentVolume) (map[string]string, error) {
// Ignore if not Cinder.
if pv.Spec.Cinder == nil {
return nil, nil
}
// Ignore any volumes that are being provisioned
if pv.Spec.Cinder.VolumeID == k8s_volume.ProvisionedVolumeName {
return nil, nil