Skip to content

Commit 25b5d21

Browse files
Merge pull request #9048 from sadasu/sadasu-6508
OCPBUGS-6508: Update Control Plane replica validation for Single Node OpenShift
2 parents d98c9cb + 7629e70 commit 25b5d21

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

pkg/asset/machines/master.go

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,17 @@ func (m *Master) Generate(ctx context.Context, dependencies asset.Parents) error
185185
var ipClaims []ipamv1.IPAddressClaim
186186
var ipAddrs []ipamv1.IPAddress
187187
var controlPlaneMachineSet *machinev1.ControlPlaneMachineSet
188+
189+
// Check if SNO topology is supported on this platform
190+
if pool.Replicas != nil && *pool.Replicas == 1 {
191+
bootstrapInPlace := false
192+
if ic.BootstrapInPlace != nil {
193+
bootstrapInPlace = true
194+
}
195+
if !supportedSingleNodePlatform(bootstrapInPlace, ic.Platform.Name()) {
196+
return fmt.Errorf("this install method does not support Single Node installation on platform %s", ic.Platform.Name())
197+
}
198+
}
188199
switch ic.Platform.Name() {
189200
case awstypes.Name:
190201
subnets, err := aws.MachineSubnetsByZones(ctx, installConfig, awstypes.ClusterNodeSubnetRole)
@@ -967,6 +978,20 @@ func IsFencingCredentialsFile(filepath string) (bool, error) {
967978
if err != nil {
968979
return false, err
969980
}
970-
971981
return match, nil
972982
}
983+
984+
// supportedSingleNodePlatform indicates if the IPI Installer can be used to install SNO on
985+
// a platform.
986+
func supportedSingleNodePlatform(bootstrapInPlace bool, platformName string) bool {
987+
switch platformName {
988+
case awstypes.Name, gcptypes.Name, azuretypes.Name, powervstypes.Name:
989+
// Single node OpenShift installations supported without `bootstrapInPlace`
990+
return true
991+
case nonetypes.Name, externaltypes.Name:
992+
// Single node OpenShift installations supported with `bootstrapInPlace`
993+
return bootstrapInPlace
994+
default:
995+
return false
996+
}
997+
}

pkg/asset/machines/master_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,14 +275,14 @@ func TestBaremetalGeneratedAssetFiles(t *testing.T) {
275275
},
276276
},
277277
ControlPlane: &types.MachinePool{
278-
Replicas: pointer.Int64Ptr(1),
278+
Replicas: ptr.To[int64](3),
279279
Platform: types.MachinePoolPlatform{
280280
BareMetal: &baremetal.MachinePool{},
281281
},
282282
},
283283
Compute: []types.MachinePool{
284284
{
285-
Replicas: pointer.Int64Ptr(1),
285+
Replicas: ptr.To[int64](1),
286286
Platform: types.MachinePoolPlatform{},
287287
},
288288
},

0 commit comments

Comments
 (0)