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 now preserve as tags on the volume.

kubernetes-csi/external-provisioner#399
  • Loading branch information
databus23 committed Apr 22, 2021
1 parent 7361943 commit 4690f05
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/csi/cinder/controllerserver.go
Original file line number Diff line number Diff line change
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 4690f05

Please sign in to comment.