Skip to content

Commit

Permalink
OpenStack support in CPMS
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilienM committed Apr 19, 2023
1 parent dd3df54 commit 41d0792
Show file tree
Hide file tree
Showing 15 changed files with 1,484 additions and 4 deletions.
13 changes: 13 additions & 0 deletions docs/user/failure-domains.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,16 @@ An Azure failure domain will look something like the example below:
```yaml
- zone: "<zone>"
```
## OpenStack
On OpenStack, the failure domains represented in the control plane machine set can be considered analogous to the
OpenStack availability zones (for Nova and Cinder).
An OpenStack failure domain will look something like the example below:
```yaml
- computeAvailabilityZone: "<zone>"
storageAvailabilityZone: "<zone>"
```
They are both optional and also can be set alone.
28 changes: 28 additions & 0 deletions docs/user/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,3 +238,31 @@ failureDomains:

> Note: The `targetPools` field may not be set on the GCP providerSpec. This field is required for control
plane machines and you should populate this on both the Machine and the ControlPlaneMachineSet resource specs.

#### Configuring a control plane machine set on OpenStack

Two fields are supported for now: `computeAvailabilityZone` (instance AZ) and `storageAvailabilityZone` (root volume AZ).
Gather the existing control plane machines and note the value of the zones of each if they exist.
Aside from these fields, the remaining in spec the machines should be identical.

Copy the value from one of the machines into the `providerSpec.value` (6) on the example above.
Remove the AZ fields from the `providerSpec.value` once you have done that.

For each AZ you have in the cluster (normally 3), configure a failure domain like below:
```yaml
- computeAvailabilityZone: "<zone>"
storageAvailabilityZone: "<zone>"
```

With these zones, the complete `failureDomains` (3 and 4) on the example above should look something like below:
```yaml
failureDomains:
platform: OpenStack
openstack:
- computeAvailabilityZone: "us-central1-a"
storageAvailabilityZone: "us-central1-a"
- computeAvailabilityZone: "us-central1-b"
storageAvailabilityZone: "us-central1-b"
- computeAvailabilityZone: "us-central1-c"
storageAvailabilityZone: "us-central1-c"
```
7 changes: 7 additions & 0 deletions pkg/controllers/controlplanemachinesetgenerator/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ func (r *ControlPlaneMachineSetGeneratorReconciler) reconcile(ctx context.Contex
}

// generateControlPlaneMachineSet generates a control plane machine set based on the current cluster state.
//
//nolint:cyclop
func (r *ControlPlaneMachineSetGeneratorReconciler) generateControlPlaneMachineSet(logger logr.Logger,
platformType configv1.PlatformType, machines []machinev1beta1.Machine, machineSets []machinev1beta1.MachineSet) (*machinev1.ControlPlaneMachineSet, error) {
var (
Expand All @@ -233,6 +235,11 @@ func (r *ControlPlaneMachineSetGeneratorReconciler) generateControlPlaneMachineS
if err != nil {
return nil, fmt.Errorf("unable to generate control plane machine set spec: %w", err)
}
case configv1.OpenStackPlatformType:
cpmsSpecApplyConfig, err = generateControlPlaneMachineSetOpenStackSpec(machines, machineSets)
if err != nil {
return nil, fmt.Errorf("unable to generate control plane machine set spec: %w", err)
}
default:
logger.V(1).WithValues("platform", platformType).Info(unsupportedPlatform)
return nil, errUnsupportedPlatform
Expand Down
Loading

0 comments on commit 41d0792

Please sign in to comment.