Skip to content

Commit

Permalink
Cleanup csi.openstorage.org parameters after adding to VolumeLabels (#…
Browse files Browse the repository at this point in the history
…1440)

Signed-off-by: Grant Griffiths <[email protected]>
  • Loading branch information
ggriffiths authored Feb 26, 2020
1 parent 05b8c9b commit 798ebd8
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions csi/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,15 @@ func getPVCMetadata(params map[string]string) (map[string]string, error) {
return metadata, nil
}

func cleanupVolumeLabels(labels map[string]string) map[string]string {
delete(labels, osdPvcNameKey)
delete(labels, osdPvcNamespaceKey)
delete(labels, osdPvcAnnotationsKey)
delete(labels, osdPvcLabelsKey)

return labels
}

// CreateVolume is a CSI API which creates a volume on OSD
// This function supports snapshots if the parent volume id is supplied
// in the parameters.
Expand Down Expand Up @@ -365,6 +374,9 @@ func (s *OsdCsiServer) CreateVolume(
spec.Size = defaultCSIVolumeSize
}

// cleanup duplicate information after pulling from req.GetParameters
locator.VolumeLabels = cleanupVolumeLabels(locator.VolumeLabels)

// Get grpc connection
conn, err := s.getConn()
if err != nil {
Expand Down

0 comments on commit 798ebd8

Please sign in to comment.