util: add helper to get pvcnamespace from input

added helper function to return the pvc namespace
name from the input parameters.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna
2022-03-16 19:19:06 +05:30
committed by mergify[bot]
parent 772fe8d6c8
commit 366c2ace31
2 changed files with 39 additions and 0 deletions

View File

@ -23,6 +23,7 @@ import (
// to the driver on CreateVolumeRequest/CreateSnapshotRequest calls.
const (
csiParameterPrefix = "csi.storage.k8s.io/"
pvcNamespaceKey = "csi.storage.k8s.io/pvc/namespace"
)
// RemoveCSIPrefixedParameters removes parameters prefixed with csiParameterPrefix.
@ -37,3 +38,8 @@ func RemoveCSIPrefixedParameters(param map[string]string) map[string]string {
return newParam
}
// GetOwner returns the pvc namespace name from the parameter.
func GetOwner(param map[string]string) string {
return param[pvcNamespaceKey]
}