From 04ee2d91fd8fd864f4e97880f0cb915de603a03b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Wed, 12 Feb 2020 11:06:54 +0100 Subject: [PATCH] ceph: populate CSI configmap for external cluster MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- pkg/operator/ceph/cluster/controller.go | 15 ++++++++++++++- pkg/operator/ceph/csi/cluster_config.go | 5 ++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/pkg/operator/ceph/cluster/controller.go b/pkg/operator/ceph/cluster/controller.go index 1683bec16..7900e1741 100644 --- a/pkg/operator/ceph/cluster/controller.go +++ b/pkg/operator/ceph/cluster/controller.go @@ -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 { diff --git a/pkg/operator/ceph/csi/cluster_config.go b/pkg/operator/ceph/csi/cluster_config.go index a76aabaf1..56f1d6e2b 100644 --- a/pkg/operator/ceph/csi/cluster_config.go +++ b/pkg/operator/ceph/csi/cluster_config.go @@ -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 }