Merge pull request #64895 from harsh-px/64894

Automatic merge from submit-queue (batch tested with PRs 64895, 64938, 63700, 65050, 64957). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

In case storage class parameters are empty, create a new map for Portworx volume labels

Signed-off-by: Harsh Desai <harsh@portworx.com>

**What this PR does / why we need it**:

Fixes #64894

**Release note**:
```release-note
Fixes an issue where Portworx PVCs remain in pending state when created using a StorageClass with empty parameters
```
pull/8/head
Kubernetes Submit Queue 2018-06-21 04:15:04 -07:00 committed by GitHub
commit f04218071f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -71,8 +71,13 @@ func (util *PortworxVolumeUtil) CreateVolume(p *portworxVolumeProvisioner) (stri
spec = specHandler.DefaultSpec()
}
// Pass all parameters as volume labels for Portworx server-side processing.
spec.VolumeLabels = p.options.Parameters
// Pass all parameters as volume labels for Portworx server-side processing
if len(p.options.Parameters) > 0 {
spec.VolumeLabels = p.options.Parameters
} else {
spec.VolumeLabels = make(map[string]string, 0)
}
// Update the requested size in the spec
spec.Size = uint64(requestGiB * volutil.GIB)