From 242f98e94bccb4c1299a73a96725a3291f3dd4b2 Mon Sep 17 00:00:00 2001 From: parth-gr Date: Mon, 15 Nov 2021 16:12:15 +0530 Subject: [PATCH] mon: update mons Cluster ClusterInfo with CR name the mons re-initialize its ClusterInfo which results in missing CR name on the ClusterInfo Set the CR name to the mons cluster ClusterInfo Closes: https://github.com/rook/rook/issues/9159 Signed-off-by: parth-gr --- pkg/operator/ceph/cluster/mon/mon.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/operator/ceph/cluster/mon/mon.go b/pkg/operator/ceph/cluster/mon/mon.go index a5e793404744..a3f615705442 100644 --- a/pkg/operator/ceph/cluster/mon/mon.go +++ b/pkg/operator/ceph/cluster/mon/mon.go @@ -208,7 +208,7 @@ func (c *Cluster) Start(clusterInfo *cephclient.ClusterInfo, rookVersion string, logger.Infof("start running mons") logger.Debugf("establishing ceph cluster info") - if err := c.initClusterInfo(cephVersion); err != nil { + if err := c.initClusterInfo(cephVersion, c.ClusterInfo.NamespacedName().Name); err != nil { return nil, errors.Wrap(err, "failed to initialize ceph cluster info") } @@ -477,7 +477,7 @@ func (c *Cluster) ensureMonsRunning(mons []*monConfig, i, targetCount int, requi // initClusterInfo retrieves the ceph cluster info if it already exists. // If a new cluster, create new keys. -func (c *Cluster) initClusterInfo(cephVersion cephver.CephVersion) error { +func (c *Cluster) initClusterInfo(cephVersion cephver.CephVersion, clusterName string) error { var err error context := c.ClusterInfo.Context @@ -490,6 +490,7 @@ func (c *Cluster) initClusterInfo(cephVersion cephver.CephVersion) error { c.ClusterInfo.CephVersion = cephVersion c.ClusterInfo.OwnerInfo = c.ownerInfo c.ClusterInfo.Context = context + c.ClusterInfo.SetName(clusterName) // save cluster monitor config if err = c.saveMonConfig(); err != nil {