diff --git a/pkg/asset/manifests/ingress_test.go b/pkg/asset/manifests/ingress_test.go index 1d76c91a1fe..b512833d103 100644 --- a/pkg/asset/manifests/ingress_test.go +++ b/pkg/asset/manifests/ingress_test.go @@ -135,7 +135,7 @@ func TestGenerateIngerssDefaultPlacement(t *testing.T) { name: "aws single node with 0 or 1 day-1 workers", installConfigBuildOptions: []icOption{icBuild.forAWS()}, controlPlaneTopology: configv1.SingleReplicaTopologyMode, - infrastructureTopology: configv1.SingleReplicaTopologyMode, + infrastructureTopology: configv1.HighlyAvailableTopologyMode, expectedIngressAWSLBType: configv1.Classic, expectedIngressPlacement: configv1.DefaultPlacementWorkers, }, @@ -143,7 +143,7 @@ func TestGenerateIngerssDefaultPlacement(t *testing.T) { name: "aws multi-node with 1 day-1 worker", installConfigBuildOptions: []icOption{icBuild.forAWS()}, controlPlaneTopology: configv1.HighlyAvailableTopologyMode, - infrastructureTopology: configv1.SingleReplicaTopologyMode, + infrastructureTopology: configv1.HighlyAvailableTopologyMode, expectedIngressAWSLBType: configv1.Classic, expectedIngressPlacement: configv1.DefaultPlacementWorkers, }, @@ -187,14 +187,14 @@ func TestGenerateIngerssDefaultPlacement(t *testing.T) { name: "none-platform single node with 0 or 1 day-1 workers", installConfigBuildOptions: []icOption{icBuild.forNone()}, controlPlaneTopology: configv1.SingleReplicaTopologyMode, - infrastructureTopology: configv1.SingleReplicaTopologyMode, + infrastructureTopology: configv1.HighlyAvailableTopologyMode, expectedIngressPlacement: configv1.DefaultPlacementControlPlane, }, { name: "none-platform multi-node with 1 day-1 worker", installConfigBuildOptions: []icOption{icBuild.forNone()}, controlPlaneTopology: configv1.HighlyAvailableTopologyMode, - infrastructureTopology: configv1.SingleReplicaTopologyMode, + infrastructureTopology: configv1.HighlyAvailableTopologyMode, expectedIngressPlacement: configv1.DefaultPlacementWorkers, }, { diff --git a/pkg/asset/manifests/scheduler.go b/pkg/asset/manifests/scheduler.go index 4222ed3e2ab..cd24c32710a 100644 --- a/pkg/asset/manifests/scheduler.go +++ b/pkg/asset/manifests/scheduler.go @@ -63,14 +63,9 @@ func (s *Scheduler) Generate(_ context.Context, dependencies asset.Parents) erro computeReplicas += *pool.Replicas } } - if computeReplicas == 0 { + if computeReplicas < 2 { // A schedulable host is required for a successful install to complete. - // If the install config has 0 replicas for compute hosts, it's one of two cases: - // 1. An IPI deployment with no compute hosts. The deployment can not succeed - // without MastersSchedulable = true. - // 2. A UPI deployment. The deployment may add compute hosts, but to ensure the - // the highest probability of a successful deployment, we default to - // schedulable masters. + // Set the control planes to schedulable if the install config has < 2 replicas for compute hosts. logrus.Warningf("Making control-plane schedulable by setting MastersSchedulable to true for Scheduler cluster settings") config.Spec.MastersSchedulable = true } diff --git a/pkg/asset/manifests/topologies.go b/pkg/asset/manifests/topologies.go index 5d837e83d1d..454fc464157 100644 --- a/pkg/asset/manifests/topologies.go +++ b/pkg/asset/manifests/topologies.go @@ -28,6 +28,11 @@ func determineTopologies(installConfig *types.InstallConfig) (controlPlaneTopolo for _, mp := range installConfig.Compute { numOfWorkers += ptr.Deref(mp.Replicas, 0) } + if numOfWorkers < 2 { + // Control planes are schedulable when there are < 2 workers. + // Adjust the number of schedulable nodes here to reflect. + numOfWorkers += controlPlaneReplicas + } switch numOfWorkers { case 0: diff --git a/pkg/asset/manifests/topologies_test.go b/pkg/asset/manifests/topologies_test.go index 4c96fdc7533..23f7f4ee628 100644 --- a/pkg/asset/manifests/topologies_test.go +++ b/pkg/asset/manifests/topologies_test.go @@ -66,7 +66,7 @@ func Test_DetermineTopologies(t *testing.T) { }, }, expectedControlPlane: configv1.SingleReplicaTopologyMode, - expectedInfra: configv1.SingleReplicaTopologyMode, + expectedInfra: configv1.HighlyAvailableTopologyMode, }, { desc: "should default infra to HA and controlPlane to DualReplica for 2 control replicas", @@ -125,6 +125,21 @@ func Test_DetermineTopologies(t *testing.T) { expectedControlPlane: configv1.HighlyAvailableTopologyMode, expectedInfra: configv1.HighlyAvailableTopologyMode, }, + { + desc: "should set infra to HA controlPlane and compute from controlPlane value", + installConfig: &types.InstallConfig{ + ControlPlane: &types.MachinePool{ + Replicas: ptr.To[int64](3), + }, + Compute: []types.MachinePool{ + { + Replicas: ptr.To[int64](1), + }, + }, + }, + expectedControlPlane: configv1.HighlyAvailableTopologyMode, + expectedInfra: configv1.HighlyAvailableTopologyMode, + }, } for _, tc := range testCases { t.Run(tc.desc, func(t *testing.T) {