Skip to content

Commit

Permalink
Add support for no failure domains in OpenStack platform
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilienM committed Jun 28, 2023
1 parent 6239d9b commit e9c1526
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2235,7 +2235,11 @@ var _ = Describe("controlplanemachinesetgenerator controller on OpenStack", func
Zone: "cinder-az5",
})

cpmsNoFailureDomainsBuilderOpenStack = machinev1.FailureDomains{}
cpmsEmptyFailureDomainsBuilderOpenStack = machinev1.FailureDomains{}

cpmsNoFailureDomainsBuilderOpenStack = machinev1.FailureDomains{
Platform: "",
}

cpms3FailureDomainsBuilderOpenStack = machinev1resourcebuilder.OpenStackFailureDomains().WithFailureDomainBuilders(
az1FailureDomainBuilderOpenStack,
Expand Down Expand Up @@ -2550,6 +2554,7 @@ var _ = Describe("controlplanemachinesetgenerator controller on OpenStack", func
By("Checking the Control Plane Machine Set has been created")
Eventually(komega.Get(cpms)).Should(Succeed())

Expect(cpms.Spec.Template.OpenShiftMachineV1Beta1Machine.FailureDomains).To(Equal(cpmsEmptyFailureDomainsBuilderOpenStack))
Expect(cpms.Spec.Template.OpenShiftMachineV1Beta1Machine.FailureDomains).To(Equal(cpmsNoFailureDomainsBuilderOpenStack))
})

Expand Down
2 changes: 1 addition & 1 deletion pkg/controllers/controlplanemachinesetgenerator/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ func buildFailureDomains(logger logr.Logger, machineSets []machinev1beta1.Machin
return nil, fmt.Errorf("failed to build OpenStack failure domains: %w", err)
}

if cpmsFailureDomain.OpenStack == nil {
if cpmsFailureDomain.OpenStack == nil || cpmsFailureDomain.Platform == "" {
return nil, nil //nolint:nilnil
}
default:
Expand Down

0 comments on commit e9c1526

Please sign in to comment.