mon: fix mon health nil pointer exception

shouldFailoverMonImmediately has a nil pointer exception with mons on
PVC. Rook-ceph-mon-endpoint does not store node information of the mons
on PVC. So `mapping.Hostname` throws nill pointer

Signed-off-by: Santosh Pillai <sapillai@redhat.com>
This commit is contained in:
Santosh Pillai committed 2025-09-15 18:13:46 +05:30
1 parent 99f64dc1d9
commit d399615bdc
1 file changed
+5
+5
View File
@@ -394,6 +394,11 @@ func (c *Cluster) shouldFailoverMonImmediately(ctx context.Context, monName stri
logger.Debugf("checking if mon %q is scheduled on a node", monName)
assignedNode := ""
if mapping, ok := c.mapping.Schedule[monName]; ok {
if mapping == nil {
// mon schedule information is not available in the rook-ceph-mon-endpoints configmap in case of mons on PVC
logger.Debugf("mon schedule information is not available for mon %q", monName)
return false
}
assignedNode = mapping.Hostname
}
if assignedNode == "" {