fix aws provider to handle only EBS volumes

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

fixes #68996
This commit is contained in:
Martin Vladev
2018-10-30 16:35:38 +02:00
parent fda41d14c4
commit fa80dd5354
3 changed files with 99 additions and 0 deletions

View File

@@ -2323,6 +2323,11 @@ func (c *Cloud) checkIfAvailable(disk *awsDisk, opName string, instance string)
// GetLabelsForVolume gets the volume labels for a volume
func (c *Cloud) GetLabelsForVolume(ctx context.Context, pv *v1.PersistentVolume) (map[string]string, error) {
// Ignore if not AWSElasticBlockStore.
if pv.Spec.AWSElasticBlockStore == nil {
return nil, nil
}
// Ignore any volumes that are being provisioned
if pv.Spec.AWSElasticBlockStore.VolumeID == volume.ProvisionedVolumeName {
return nil, nil