Commit 79ea511e authored by Harsh Desai's avatar Harsh Desai

Pass pvc namespace and annotations to Portworx Create API

Closes #59606 Signed-off-by: 's avatarHarsh Desai <harsh@portworx.com>
parent 2172a2a8
...@@ -34,6 +34,7 @@ const ( ...@@ -34,6 +34,7 @@ const (
osdDriverVersion = "v1" osdDriverVersion = "v1"
pxdDriverName = "pxd" pxdDriverName = "pxd"
pvcClaimLabel = "pvc" pvcClaimLabel = "pvc"
pvcNamespaceLabel = "namespace"
pxServiceName = "portworx-service" pxServiceName = "portworx-service"
pxDriverName = "pxd-sched" pxDriverName = "pxd-sched"
) )
...@@ -80,9 +81,20 @@ func (util *PortworxVolumeUtil) CreateVolume(p *portworxVolumeProvisioner) (stri ...@@ -80,9 +81,20 @@ func (util *PortworxVolumeUtil) CreateVolume(p *portworxVolumeProvisioner) (stri
// Add claim Name as a part of Portworx Volume Labels // Add claim Name as a part of Portworx Volume Labels
locator.VolumeLabels[pvcClaimLabel] = p.options.PVC.Name locator.VolumeLabels[pvcClaimLabel] = p.options.PVC.Name
locator.VolumeLabels[pvcNamespaceLabel] = p.options.PVC.Namespace
for k, v := range p.options.PVC.Annotations {
if _, present := spec.VolumeLabels[k]; present {
glog.Warningf("not saving annotation: %s=%s in spec labels due to an existing key", k, v)
continue
}
spec.VolumeLabels[k] = v
}
volumeID, err := driver.Create(locator, source, spec) volumeID, err := driver.Create(locator, source, spec)
if err != nil { if err != nil {
glog.Errorf("Error creating Portworx Volume : %v", err) glog.Errorf("Error creating Portworx Volume : %v", err)
return "", 0, nil, err
} }
glog.Infof("Successfully created Portworx volume for PVC: %v", p.options.PVC.Name) glog.Infof("Successfully created Portworx volume for PVC: %v", p.options.PVC.Name)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment