ceph: populate CSI configmap for external cluster

The configmap for csi wasn't created so csi wasn't working.

Closes: https://github.com/rook/rook/issues/4816
Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
Sébastien Han committed 2020-02-12 17:58:53 +01:00
1 parent 6a2a5dcf2c
commit 04ee2d91fd
2 files changed
+18 -2

No files matched your search

+14 -1
View File
@@ -312,7 +312,7 @@ func (c *ClusterController) configureExternalCephCluster(namespace, name string,
if !cluster.Info.IsInitialized() {
return errors.Errorf("the cluster identity was not established: %+v", cluster.Info)
}
logger.Info("cluster identity established.")
logger.Info("external cluster identity established.")
// Everything went well so let's update the CR's status to "connected"
config.ConditionExport(c.context, namespace, name,
@@ -324,6 +324,19 @@ func (c *ClusterController) configureExternalCephCluster(namespace, name string,
return errors.Wrapf(err, "failed to create csi kubernetes secrets")
}
// Create CSI config map
_, err = csi.CreateCsiConfigMap(namespace, c.context.Clientset)
if err != nil {
return errors.Wrap(err, "failed to create csi config map")
}
// Save CSI configmap
err = csi.SaveClusterConfig(c.context.Clientset, namespace, cluster.Info, c.csiConfigMutex)
if err != nil {
return errors.Wrap(err, "failed to update csi cluster config")
}
logger.Infof("successfully updated csi config map")
// Create Crash Collector Secret
// In 14.2.5 the crash daemon will read the client.crash key instead of the admin key
if !cluster.Spec.CrashCollector.Disable {
+4 -1
View File
@@ -138,6 +138,8 @@ func CreateCsiConfigMap(namespace string, clientset kubernetes.Interface) (*v1.C
}
return getCsiConfigMap(namespace, clientset)
}
logger.Infof("successfully created csi config map %q", configMap.Name)
return created, nil
}
@@ -160,7 +162,7 @@ func DeleteCsiConfigMap(namespace string, clientset kubernetes.Interface) error
// SaveClusterConfig updates the config map used to provide ceph-csi with
// basic cluster configuration. The clusterNamespace and clusterInfo are
// used to determine what "cluster" in the config map will be updated and
// and the clusterNamespace value is epxected to match the clusterID
// and the clusterNamespace value is expected to match the clusterID
// value that is provided to ceph-csi uses in the storage class.
// The locker l is typically a mutex and is used to prevent the config
// map from being updated for multiple clusters simultaneously.
@@ -203,5 +205,6 @@ func SaveClusterConfig(
if _, err := clientset.CoreV1().ConfigMaps(csiNamespace).Update(configMap); err != nil {
return errors.Wrapf(err, "failed to update csi config map")
}
return nil
}