ceph: prevent operator crash with host networking and mon not found
When the node is not found for mon assignment with host networking enabled, the operator may crash. This change ensures the node is not nil and returns an error instead of crashing. Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
This commit is contained in:
1 file changed
+2
-2
@@ -789,8 +789,8 @@ func (c *Cluster) initMonIPs(mons []*monConfig) error {
|
||||
if c.spec.Network.IsHost() {
|
||||
logger.Infof("setting mon endpoints for hostnetwork mode")
|
||||
node, ok := c.mapping.Schedule[m.DaemonName]
|
||||
if !ok {
|
||||
return errors.New("mon doesn't exist in assignment map")
|
||||
if !ok || node == nil {
|
||||
return fmt.Errorf("node for mon %q doesn't exist in assignment map", m.DaemonName)
|
||||
}
|
||||
m.PublicIP = node.Address
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user