diff --git a/pkg/operator/ceph/cluster/cluster.go b/pkg/operator/ceph/cluster/cluster.go index 8d4624030..613b6e8fa 100755 --- a/pkg/operator/ceph/cluster/cluster.go +++ b/pkg/operator/ceph/cluster/cluster.go @@ -307,8 +307,12 @@ func preClusterStartValidation(cluster *cluster) error { } if !cluster.Spec.Mon.AllowMultiplePerNode { // Check that there are enough nodes to have a chance of starting the requested number of mons + monCountToSchedule := cluster.Spec.Mon.Count + if cluster.Spec.Mon.FloatingMon.Name != "" { + monCountToSchedule-- + } nodes, err := cluster.context.Clientset.CoreV1().Nodes().List(cluster.ClusterInfo.Context, metav1.ListOptions{}) - if err == nil && len(nodes.Items) < cluster.Spec.Mon.Count { + if err == nil && len(nodes.Items) < monCountToSchedule { return errors.Errorf("cannot start %d mons on %d node(s) when allowMultiplePerNode is false", cluster.Spec.Mon.Count, len(nodes.Items)) } } diff --git a/pkg/operator/ceph/cluster/cluster_test.go b/pkg/operator/ceph/cluster/cluster_test.go index 2d779643e..ed6fce0ab 100644 --- a/pkg/operator/ceph/cluster/cluster_test.go +++ b/pkg/operator/ceph/cluster/cluster_test.go @@ -81,6 +81,10 @@ func TestPreClusterStartValidation(t *testing.T) { {Name: "b"}, {Name: "c"}, }}}}}}, true}, + {"TNF cluster with floating mon", args{&cluster{ClusterInfo: cephclient.AdminTestClusterInfo("rook-ceph"), context: &clusterd.Context{Clientset: testop.New(t, 2)}, Spec: &cephv1.ClusterSpec{Mon: cephv1.MonSpec{Count: 3, AllowMultiplePerNode: false, FloatingMon: cephv1.FloatingMonSpec{ + Name: "c", + ConfigMapName: "rook-floating-mon-config", + }}}}}, false}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) {