Skip to content

Commit

Permalink
Allow for omiting AZ from control plane nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
mkjpryor committed Aug 1, 2022
1 parent 6859acb commit a71a77e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
4 changes: 4 additions & 0 deletions api/v1alpha6/openstackcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ type OpenStackClusterSpec struct {
// ControlPlaneAvailabilityZones is the az to deploy control plane to
ControlPlaneAvailabilityZones []string `json:"controlPlaneAvailabilityZones,omitempty"`

// Indicates whether to omit the az for control plane nodes, allowing the Nova scheduler
// to make a decision on which az to use based on other scheduling constraints
ControlPlaneOmitAvailabilityZone bool `json:"controlPlaneOmitAvailabilityZone,omitempty"`

// Bastion is the OpenStack instance to login the nodes
//
// As a rolling update is not ideal during a bastion host session, we
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4724,6 +4724,11 @@ spec:
- host
- port
type: object
controlPlaneOmitAvailabilityZone:
description: Indicates whether to omit the az for control plane nodes,
allowing the Nova scheduler to make a decision on which az to use
based on other scheduling constraints
type: boolean
disableAPIServerFloatingIP:
description: DisableAPIServerFloatingIP determines whether or not
to attempt to attach a floating IP to the API server. This allows
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1962,6 +1962,11 @@ spec:
- host
- port
type: object
controlPlaneOmitAvailabilityZone:
description: Indicates whether to omit the az for control
plane nodes, allowing the Nova scheduler to make a decision
on which az to use based on other scheduling constraints
type: boolean
disableAPIServerFloatingIP:
description: DisableAPIServerFloatingIP determines whether
or not to attempt to attach a floating IP to the API server.
Expand Down
17 changes: 6 additions & 11 deletions controllers/openstackcluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,21 +280,16 @@ func reconcileNormal(ctx context.Context, scope *scope.Scope, patchHelper *patch
return ctrl.Result{}, err
}

// Create a new list to remove any Availability
// Zones that have been removed from OpenStack
// Create a new list in case any AZs have been removed from OpenStack
openStackCluster.Status.FailureDomains = make(clusterv1.FailureDomains)
for _, az := range availabilityZones {
found := true
// If Az given, then check whether it's in the allow list
// If no Az given, then by default put into allow list
// By default, the AZ is used or not used for control plane nodes depending on the flag
found := !openStackCluster.Spec.ControlPlaneOmitAvailabilityZone
// If explicit AZs for control plane nodes are given, they override the value
if len(openStackCluster.Spec.ControlPlaneAvailabilityZones) > 0 {
if contains(openStackCluster.Spec.ControlPlaneAvailabilityZones, az.ZoneName) {
found = true
} else {
found = false
}
found = contains(openStackCluster.Spec.ControlPlaneAvailabilityZones, az.ZoneName)
}

// Add the AZ object to the failure domains for the cluster
openStackCluster.Status.FailureDomains[az.ZoneName] = clusterv1.FailureDomainSpec{
ControlPlane: found,
}
Expand Down

0 comments on commit a71a77e

Please sign in to comment.