mirror of https://github.com/k3s-io/k3s
Merge pull request #59607 from harsh-px/px-pvc
Automatic merge from submit-queue (batch tested with PRs 59607, 59232). 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>. Pass pvc namespace and annotations to Portworx Create API Signed-off-by: Harsh Desai <harsh@portworx.com> **What this PR does / why we need it**: Fixes #59606 **Release note**: ```release-note NONE ```pull/6/head
commit
afaabe05f7
|
@ -34,6 +34,7 @@ const (
|
|||
osdDriverVersion = "v1"
|
||||
pxdDriverName = "pxd"
|
||||
pvcClaimLabel = "pvc"
|
||||
pvcNamespaceLabel = "namespace"
|
||||
pxServiceName = "portworx-service"
|
||||
pxDriverName = "pxd-sched"
|
||||
)
|
||||
|
@ -80,9 +81,20 @@ func (util *PortworxVolumeUtil) CreateVolume(p *portworxVolumeProvisioner) (stri
|
|||
|
||||
// Add claim Name as a part of Portworx Volume Labels
|
||||
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)
|
||||
if err != nil {
|
||||
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)
|
||||
|
|
Loading…
Reference in New Issue