Skip to content

Commit

Permalink
[cinder-csi-plugin] Tag volume with optional metadata
Browse files Browse the repository at this point in the history
The external CSI provisioner optionally injects metadata in the CreateVolume that we can pass onto the volume as additional tags.
See kubernetes-csi/external-provisioner#399

Signed-off-by: Fabian Ruff <fabian.ruff@sap.com>
  • Loading branch information
databus23 committed Apr 22, 2021
1 parent 7361943 commit 1c4514f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/csi/cinder/controllerserver.go
Expand Up @@ -103,6 +103,12 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol

// Volume Create
properties := map[string]string{"cinder.csi.openstack.org/cluster": cs.Driver.cluster}
//Tag volume with metadata if present: https://github.com/kubernetes-csi/external-provisioner/pull/399
for _, mKey := range []string{"csi.storage.k8s.io/pvc/name", "csi.storage.k8s.io/pvc/namespace", "csi.storage.k8s.io/pv/name"} {
if v, ok := req.Parameters[mKey]; ok {
properties[mKey] = v
}
}
content := req.GetVolumeContentSource()
var snapshotID string
var sourcevolID string
Expand Down

0 comments on commit 1c4514f

Please sign in to comment.