mon: fix floating mon validation in TNF deployments
The floating mon in a TNF cluster is designed to share a node with a pinned mon. Fixed the pre-cluster start evaluation logic to allow the same when allowMultiplePerNode is set to false.
Signed-off-by: Prabhala Tara Aasrita <taraasrita@ibm.com>
(cherry picked from commit 8e205b194c)
This commit is contained in:
1 parent
ef3871fb76
commit
5af4ecc44f
2 files changed
+9
-1
No files matched your search
@@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user