From a4f665052d95cabfb60d403d44dc298f6f5d4f05 Mon Sep 17 00:00:00 2001 From: ehila Date: Tue, 11 Nov 2025 00:57:30 -0500 Subject: [PATCH] feat: allow none platform for tna Currently two node arbiter supports only baremetal, platform none is also used for baremetal deployments and should be supported. Platform external is also being added as that can be used for baremetal deployments and platform none will be deprecated in the future. Signed-off-by: ehila --- pkg/types/validation/installconfig.go | 5 +- pkg/types/validation/installconfig_test.go | 114 +++++++++++++++++++++ 2 files changed, 117 insertions(+), 2 deletions(-) diff --git a/pkg/types/validation/installconfig.go b/pkg/types/validation/installconfig.go index bda2e4562d..30f3c12053 100644 --- a/pkg/types/validation/installconfig.go +++ b/pkg/types/validation/installconfig.go @@ -39,6 +39,7 @@ import ( gcpvalidation "github.com/openshift/installer/pkg/types/gcp/validation" "github.com/openshift/installer/pkg/types/ibmcloud" ibmcloudvalidation "github.com/openshift/installer/pkg/types/ibmcloud/validation" + "github.com/openshift/installer/pkg/types/none" "github.com/openshift/installer/pkg/types/nutanix" nutanixvalidation "github.com/openshift/installer/pkg/types/nutanix/validation" "github.com/openshift/installer/pkg/types/openstack" @@ -770,8 +771,8 @@ func validateControlPlane(installConfig *types.InstallConfig, fldPath *field.Pat func validateArbiter(platform *types.Platform, arbiterPool, masterPool *types.MachinePool, fldPath *field.Path) field.ErrorList { allErrs := field.ErrorList{} - if platform != nil && platform.BareMetal == nil { - allErrs = append(allErrs, field.NotSupported(fldPath.Child("platform"), platform.Name(), []string{baremetal.Name})) + if platform != nil && (platform.BareMetal == nil && platform.None == nil && platform.External == nil) { + allErrs = append(allErrs, field.NotSupported(fldPath.Child("platform"), platform.Name(), []string{baremetal.Name, none.Name, external.Name})) } if arbiterPool.Name != types.MachinePoolArbiterRoleName { allErrs = append(allErrs, field.NotSupported(fldPath.Child("name"), arbiterPool.Name, []string{types.MachinePoolArbiterRoleName})) diff --git a/pkg/types/validation/installconfig_test.go b/pkg/types/validation/installconfig_test.go index 1546c8c1d3..97bb6a7cfc 100644 --- a/pkg/types/validation/installconfig_test.go +++ b/pkg/types/validation/installconfig_test.go @@ -2888,6 +2888,120 @@ func TestValidateReleaseArchitecture(t *testing.T) { }) } +func TestValidateArbiter(t *testing.T) { + cases := []struct { + name string + config *types.InstallConfig + machinePool *types.MachinePool + expected string + }{ + { + config: installConfig(). + PlatformNone(). + MachinePoolArbiter( + machinePool(). + Name("arbiter"). + Hyperthreading(types.HyperthreadingEnabled). + Architecture(types.ArchitectureAMD64)). + MachinePoolCP(machinePool()). + ArbiterReplicas(1). + CpReplicas(2).build(), + name: "valid_platform_none", + expected: "", + }, + { + config: installConfig(). + PlatformExternal(). + MachinePoolArbiter( + machinePool(). + Name("arbiter"). + Hyperthreading(types.HyperthreadingEnabled). + Architecture(types.ArchitectureAMD64)). + MachinePoolCP(machinePool()). + ArbiterReplicas(1). + CpReplicas(2).build(), + name: "valid_platform_external", + expected: "", + }, + { + config: installConfig(). + PlatformNone(). + MachinePoolArbiter( + machinePool(). + Name("arbiter"). + Hyperthreading(types.HyperthreadingEnabled). + Architecture(types.ArchitectureAMD64)). + MachinePoolCP(machinePool()). + ArbiterReplicas(1). + CpReplicas(2).build(), + name: "valid_platform_baremetal", + expected: "", + }, + { + config: installConfig(). + PlatformAWS(). + MachinePoolArbiter(machinePool(). + Name("arbiter"). + Hyperthreading(types.HyperthreadingEnabled). + Architecture(types.ArchitectureAMD64)). + MachinePoolCP(machinePool()). + ArbiterReplicas(1). + CpReplicas(2).build(), + name: "invalid_platform", + expected: `supported values: "baremetal", "none", "external"`, + }, + { + config: installConfig(). + PlatformNone(). + MachinePoolArbiter(machinePool(). + Hyperthreading(types.HyperthreadingEnabled). + Architecture(types.ArchitectureAMD64)). + MachinePoolCP(machinePool()). + ArbiterReplicas(1). + CpReplicas(2).build(), + name: "invalid_arbiter_machine_pool_name", + expected: `arbiter.name: Unsupported value:`, + }, + { + config: installConfig(). + PlatformNone(). + MachinePoolArbiter(machinePool(). + Name("arbiter"). + Hyperthreading(types.HyperthreadingEnabled). + Architecture(types.ArchitectureAMD64)). + MachinePoolCP(machinePool()). + ArbiterReplicas(0). + CpReplicas(2).build(), + name: "invalid_arbiter_machine_pool_size", + expected: `arbiter.replicas: Invalid value:`, + }, + { + config: installConfig(). + PlatformNone(). + MachinePoolArbiter(machinePool(). + Name("arbiter"). + Hyperthreading(types.HyperthreadingEnabled). + Architecture(types.ArchitectureAMD64)). + MachinePoolCP(machinePool()). + ArbiterReplicas(1). + CpReplicas(1).build(), + name: "invalid_master_machine_pool_size", + expected: `number of controlPlane replicas must be at least 2`, + }, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + err := validateArbiter(&tc.config.Platform, tc.config.Arbiter, tc.config.ControlPlane, field.NewPath("arbiter")).ToAggregate() + + if tc.expected == "" { + assert.NoError(t, err) + } else { + assert.Regexp(t, tc.expected, err) + } + }) + } +} + func TestValidateTNF(t *testing.T) { cases := []struct { name string