From b02190290d2134fb8b158984854971fc8829a181 Mon Sep 17 00:00:00 2001 From: Patryk Rostkowski Date: Thu, 27 Mar 2025 21:05:04 +0100 Subject: [PATCH] operator: decouple mon and mgr post-startup operations Fixes an ordering issue where spec.cephConfig settings failed to apply because the manager wasn't yet running. Moved the config logic from postMonStartupActions() to a new postMgrStartupActions() to ensure the mgr is ready before applying config, allowing successful reconciliation. Signed-off-by: Patryk Rostkowski (cherry picked from commit 44a2eaf02f6af1d262a6030cfb4fefd9bc9631bf) --- pkg/operator/ceph/cluster/cluster.go | 19 ++++++++++++++----- pkg/operator/ceph/cluster/mgr/orchestrator.go | 2 +- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/pkg/operator/ceph/cluster/cluster.go b/pkg/operator/ceph/cluster/cluster.go index e3c6e8df7..400d7df33 100755 --- a/pkg/operator/ceph/cluster/cluster.go +++ b/pkg/operator/ceph/cluster/cluster.go @@ -144,6 +144,13 @@ func (c *cluster) reconcileCephDaemons(rookImage string, cephVersion cephver.Cep return errors.Wrap(err, "failed to start ceph mgr") } + // Execute actions after the managers are up and running + logger.Debug("managers are up and running, executing post actions") + err = c.postMgrStartupActions() + if err != nil { + return errors.Wrap(err, "failed to execute post actions after all the ceph managers started") + } + // Start the OSDs controller.UpdateCondition(c.ClusterInfo.Context, c.context, c.namespacedName, k8sutil.ObservedGenerationNotAvailable, cephv1.ConditionProgressing, v1.ConditionTrue, cephv1.ClusterProgressingReason, "Configuring Ceph OSDs") osds := osd.New(c.context, c.ClusterInfo, *c.Spec, rookImage) @@ -470,11 +477,6 @@ func (c *cluster) postMonStartupActions() error { return errors.Wrap(err, "failed to configure msgr2") } - // Set config store options - if err := c.updateConfigStoreFromCRD(); err != nil { - return errors.Wrap(err, "") - } - if err := c.configureStorageSettings(); err != nil { return errors.Wrap(err, "failed to configure storage settings") } @@ -497,6 +499,13 @@ func (c *cluster) postMonStartupActions() error { return nil } +func (c *cluster) postMgrStartupActions() error { + if err := c.updateConfigStoreFromCRD(); err != nil { + return errors.Wrap(err, "failed to set config store options") + } + return nil +} + func (c *cluster) configureStorageSettings() error { if !c.shouldSetClusterFullSettings() { return nil diff --git a/pkg/operator/ceph/cluster/mgr/orchestrator.go b/pkg/operator/ceph/cluster/mgr/orchestrator.go index 67500c636..e739a3a49 100644 --- a/pkg/operator/ceph/cluster/mgr/orchestrator.go +++ b/pkg/operator/ceph/cluster/mgr/orchestrator.go @@ -31,7 +31,7 @@ const ( var orchestratorInitWaitTime = 5 * time.Second -// Ceph docs about the orchestrator modules: http://docs.ceph.com/docs/master/mgr/orchestrator_cli/ +// Ceph docs about the orchestrator modules: https://docs.ceph.com/en/latest/mgr/orchestrator/ func (c *Cluster) configureOrchestratorModules() error { if err := client.MgrEnableModule(c.context, c.clusterInfo, rookModuleName, true); err != nil { return errors.Wrap(err, "failed to enable mgr rook module")