Merge pull request #9895 from rook/mergify/bp/release-1.8/pr-9878
csi: Populate mon endpoints even if driver not enabled (backport #9878)
This commit is contained in:
1 file changed
+5
-9
@@ -190,21 +190,17 @@ func CreateCsiConfigMap(namespace string, clientset kubernetes.Interface, ownerI
|
||||
// The locker l is typically a mutex and is used to prevent the config
|
||||
// map from being updated for multiple clusters simultaneously.
|
||||
func SaveClusterConfig(clientset kubernetes.Interface, clusterNamespace string, clusterInfo *cephclient.ClusterInfo, newCsiClusterConfigEntry *CsiClusterConfigEntry) error {
|
||||
if !CSIEnabled() {
|
||||
logger.Debug("skipping csi config update because csi is not enabled")
|
||||
return nil
|
||||
}
|
||||
|
||||
configMutex.Lock()
|
||||
defer configMutex.Unlock()
|
||||
|
||||
// csi is deployed into the same namespace as the operator
|
||||
csiNamespace := os.Getenv(k8sutil.PodNamespaceEnvVar)
|
||||
if csiNamespace == "" {
|
||||
return errors.Errorf("namespace value missing for %q", k8sutil.PodNamespaceEnvVar)
|
||||
logger.Warningf("cannot save csi config due to missing env var %q", k8sutil.PodNamespaceEnvVar)
|
||||
return nil
|
||||
}
|
||||
logger.Debugf("using %q for csi configmap namespace", csiNamespace)
|
||||
|
||||
configMutex.Lock()
|
||||
defer configMutex.Unlock()
|
||||
|
||||
// fetch current ConfigMap contents
|
||||
configMap, err := clientset.CoreV1().ConfigMaps(csiNamespace).Get(clusterInfo.Context, ConfigName, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user