rbd: remove topologyConstrainedPools parameter

This commit removes the `topologyConstrainedPools` parameter
from PV volumeAttributes as it is not required.

Signed-off-by: Praveen M <m.praveen@ibm.com>
This commit is contained in:
Praveen M
2024-03-14 17:15:01 +05:30
committed by mergify[bot]
parent 9fb3743280
commit 3538b23794
5 changed files with 38 additions and 16 deletions

View File

@ -27,6 +27,7 @@ import (
"strings"
"time"
"github.com/ceph/ceph-csi/internal/util/k8s"
"github.com/ceph/ceph-csi/internal/util/log"
"golang.org/x/sys/unix"
@ -381,3 +382,34 @@ func CallStack() string {
return string(stack)
}
// CheckSliceContains checks the slice for string.
func CheckSliceContains(options []string, opt string) bool {
for _, o := range options {
if o == opt {
return true
}
}
return false
}
// GetVolumeContext filters out parameters that are not required in volume context.
func GetVolumeContext(parameters map[string]string) map[string]string {
volumeContext := map[string]string{}
// parameters that are not required in the volume context
notRequiredParams := []string{
topologyPoolsParam,
}
for k, v := range parameters {
if !CheckSliceContains(notRequiredParams, k) {
volumeContext[k] = v
}
}
// remove kubernetes csi prefixed parameters.
volumeContext = k8s.RemoveCSIPrefixedParameters(volumeContext)
return volumeContext
}