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 8e29018
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/csi/cinder/controllerserver.go
Expand Up @@ -103,6 +103,14 @@ 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 k, v := range req.Parameters {
for _, mKey := range []string{"csi.storage.k8s.io/pvc/name", "csi.storage.k8s.io/pvc/namespace", "csi.storage.k8s.io/pv/name"} {
if k == mKey {
properties[k] = v
}
}
}
content := req.GetVolumeContentSource()
var snapshotID string
var sourcevolID string
Expand Down

0 comments on commit 8e29018

Please sign in to comment.