mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 22:17:14 +00:00
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 ```
This commit is contained in:
commit
afaabe05f7
@ -30,12 +30,13 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
osdMgmtPort = "9001"
|
osdMgmtPort = "9001"
|
||||||
osdDriverVersion = "v1"
|
osdDriverVersion = "v1"
|
||||||
pxdDriverName = "pxd"
|
pxdDriverName = "pxd"
|
||||||
pvcClaimLabel = "pvc"
|
pvcClaimLabel = "pvc"
|
||||||
pxServiceName = "portworx-service"
|
pvcNamespaceLabel = "namespace"
|
||||||
pxDriverName = "pxd-sched"
|
pxServiceName = "portworx-service"
|
||||||
|
pxDriverName = "pxd-sched"
|
||||||
)
|
)
|
||||||
|
|
||||||
type PortworxVolumeUtil struct {
|
type PortworxVolumeUtil struct {
|
||||||
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user