Skip to content

Commit 4cd9eaf

Browse files
committed
Update Control Plane replica validation for Single Node OpenShift
Installer can be used to provision Single Node OpenShift(SNO) only on AWS, GCP, Azure, PowerVS and Baremetal platforms. SNO is not supported on all on-prem platforms yet. Even on the platforms that support SNO installs, the install method currently supported are assisted/agent/ZTP. Update test method TestBaremetalGeneratedAssetFiles() to create a valid Baremetal IPI install config.
1 parent 92a6804 commit 4cd9eaf

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

pkg/asset/machines/master.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,18 @@ func (m *Master) Generate(ctx context.Context, dependencies asset.Parents) error
173173
var ipClaims []ipamv1.IPAddressClaim
174174
var ipAddrs []ipamv1.IPAddress
175175
var controlPlaneMachineSet *machinev1.ControlPlaneMachineSet
176+
177+
// Check if SNO topology is supported on this platform
178+
if pool.Replicas != nil && *pool.Replicas == 1 {
179+
bootstrapInPlace := false
180+
if ic.BootstrapInPlace != nil {
181+
bootstrapInPlace = true
182+
}
183+
if !supportedSingleNodePlatform(bootstrapInPlace, ic.Platform.Name()) {
184+
return fmt.Errorf("this install method does not support Single Node installation on platform %s", ic.Platform.Name())
185+
}
186+
}
187+
176188
switch ic.Platform.Name() {
177189
case awstypes.Name:
178190
subnets, err := aws.MachineSubnetsByZones(ctx, installConfig, awstypes.ClusterNodeSubnetRole)
@@ -888,3 +900,18 @@ func createAssetFiles(objects []interface{}, fileName string) ([]*asset.File, er
888900

889901
return assetFiles, nil
890902
}
903+
904+
// supportedSingleNodePlatform indicates if the IPI Installer can be used to install SNO on
905+
// a platform.
906+
func supportedSingleNodePlatform(bootstrapInPlace bool, platformName string) bool {
907+
switch platformName {
908+
case awstypes.Name, gcptypes.Name, azuretypes.Name, powervstypes.Name:
909+
// Single node OpenShift installations supported without `bootstrapInPlace`
910+
return true
911+
case nonetypes.Name, externaltypes.Name:
912+
// Single node OpenShift installations supported with `bootstrapInPlace`
913+
return bootstrapInPlace
914+
default:
915+
return false
916+
}
917+
}

pkg/asset/machines/master_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
1212
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1313
"k8s.io/utils/pointer"
14+
"k8s.io/utils/ptr"
1415
"sigs.k8s.io/yaml"
1516

1617
"github.com/openshift/installer/pkg/asset"
@@ -273,14 +274,14 @@ func TestBaremetalGeneratedAssetFiles(t *testing.T) {
273274
},
274275
},
275276
ControlPlane: &types.MachinePool{
276-
Replicas: pointer.Int64Ptr(1),
277+
Replicas: ptr.To[int64](3),
277278
Platform: types.MachinePoolPlatform{
278279
BareMetal: &baremetal.MachinePool{},
279280
},
280281
},
281282
Compute: []types.MachinePool{
282283
{
283-
Replicas: pointer.Int64Ptr(1),
284+
Replicas: ptr.To[int64](1),
284285
Platform: types.MachinePoolPlatform{},
285286
},
286287
},

0 commit comments

Comments
 (0)