From f3b39e0fd3e06b92ced187db37666d1d066ec64a Mon Sep 17 00:00:00 2001 From: Yanhua Li Date: Wed, 23 Oct 2024 13:09:42 -0400 Subject: [PATCH] Nutanix: support multi-subnets in Machine providerSpec --- pkg/types/nutanix/validation/platform.go | 9 ++++----- pkg/types/nutanix/validation/platform_test.go | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pkg/types/nutanix/validation/platform.go b/pkg/types/nutanix/validation/platform.go index 89b31319ca4..b069ab44ccc 100644 --- a/pkg/types/nutanix/validation/platform.go +++ b/pkg/types/nutanix/validation/platform.go @@ -68,9 +68,8 @@ func ValidatePlatform(p *nutanix.Platform, fldPath *field.Path, c *types.Install } } - // Currently we only support one subnet for an OpenShift cluster - if len(p.SubnetUUIDs) != 1 || len(p.SubnetUUIDs[0]) == 0 { - allErrs = append(allErrs, field.Required(fldPath.Child("subnet"), "must specify the subnet")) + if len(p.SubnetUUIDs) == 0 || p.SubnetUUIDs[0] == "" { + allErrs = append(allErrs, field.Required(fldPath.Child("subnet"), "must specify at least one subnet")) } if c.Nutanix.LoadBalancer != nil { @@ -95,8 +94,8 @@ func ValidatePlatform(p *nutanix.Platform, fldPath *field.Path, c *types.Install allErrs = append(allErrs, field.Required(fldPath.Child("failureDomain", "prismElement", "uuid"), "failureDomain prismElement uuid cannot be empty")) } - if len(fd.SubnetUUIDs) != 1 || p.SubnetUUIDs[0] == "" { - allErrs = append(allErrs, field.Invalid(fldPath.Child("failureDomain", "subnetUUIDs"), "", "must specify one failure domain subnet uuid")) + if len(fd.SubnetUUIDs) == 0 || p.SubnetUUIDs[0] == "" { + allErrs = append(allErrs, field.Invalid(fldPath.Child("failureDomain", "subnetUUIDs"), "", "must specify at least one failure domain subnet uuid")) } for _, sc := range fd.StorageContainers { diff --git a/pkg/types/nutanix/validation/platform_test.go b/pkg/types/nutanix/validation/platform_test.go index 945fe10d098..3b32cf3a053 100644 --- a/pkg/types/nutanix/validation/platform_test.go +++ b/pkg/types/nutanix/validation/platform_test.go @@ -147,7 +147,7 @@ func TestValidatePlatform(t *testing.T) { p.SubnetUUIDs[0] = "" return p }(), - expectedError: `^test-path\.subnet: Required value: must specify the subnet$`, + expectedError: `^test-path\.subnet: Required value: must specify at least one subnet$`, }, { name: "Capital letters in Prism Central",