Skip to content

Commit

Permalink
Nutanix: support multi-subnets in Machine providerSpec
Browse files Browse the repository at this point in the history
  • Loading branch information
yanhua121 committed Oct 29, 2024
1 parent 08792a0 commit f3b39e0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions pkg/types/nutanix/validation/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion pkg/types/nutanix/validation/platform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit f3b39e0

Please sign in to comment.