diff --git a/pkg/operator/ceph/csi/cluster_config.go b/pkg/operator/ceph/csi/cluster_config.go index 3f4ad3b8c..1c95b4bf2 100644 --- a/pkg/operator/ceph/csi/cluster_config.go +++ b/pkg/operator/ceph/csi/cluster_config.go @@ -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 {