Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSASINFRA-3133 - OpenStack support #195

Merged
merged 4 commits into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions docs/user/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,14 @@ Please ensure that you have 3 (or 5) control plane machines before creating the
The control plane machine set is currently supported for a number of platforms and OpenShift versions.
The matrix shows in detail the support for each specific combination.

| Platform \ OpenShift version | <=4.11 | 4.12 | 4.13 |
|------------------------------|:---------------|:--------------------|:--------------------|
| AWS | Not Supported | Full | Full |
| Azure | Not Supported | Manual | Full |
| GCP | Not Supported | Not Supported | Full |
| VSphere | Not Supported | Manual (Single Zone)| Manual (Single Zone)|
| Other Platforms | Not Supported | Not Supported | Not Supported |

> Note: Google Cloud Platform and OpenStack are planned for inclusion from OpenShift version 4.13 onwards.
| Platform \ OpenShift version | <=4.11 | 4.12 | 4.13 | 4.14 |
|------------------------------|:---------------|:--------------------|:--------------------|:--------------------|
| AWS | Not Supported | Full | Full | Full |
| Azure | Not Supported | Manual | Full | Full |
| GCP | Not Supported | Not Supported | Full | Full |
| OpenStack | Not Supported | Not Supported | Not Supported | Full |
| VSphere | Not Supported | Manual (Single Zone)| Manual (Single Zone)| Manual (Single Zone)|
| Other Platforms | Not Supported | Not Supported | Not Supported | Not Supported |

#### Keys

Expand Down
21 changes: 21 additions & 0 deletions docs/user/failure-domains.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,24 @@ 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).

> OpenStack Availability Zones are an end-user visible logical abstraction for partitioning an OpenStack cloud without
> knowing the physical infrastructure. They are used to partition a cloud on arbitrary factors, such as location (country, datacenter, rack),
> network layout and/or power source.
> Compute (Nova) Availability Zones are presented under Host Aggregates and can help to group the compute nodes
> associated with a particular Failure Domain.
> Storage (Cinder) Availability Zones are presented under Availability Zones and help to group the storage backend types by Failure Domain.
> Depending on how the cloud is deployed, a storage backend can expand across multiple Failure Domains or be limited to a single Failure Domain.
> The name of the Availability Zones depend on the cloud deployment and can be retrieved from the OpenStack administrator.

An OpenStack failure domain will look something like the example below:
```yaml
- availabilityZone: "<nova availability zone>"
rootVolume:
availabilityZone: "<cinder availability zone>"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't we add another field to the AZ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you're talking about the volume type, it'll be handled separately via #217

```
38 changes: 38 additions & 0 deletions docs/user/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,3 +238,41 @@ 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: `availabilityZone` (instance AZ) and `rootVolume.availabilityZone` (root volume AZ).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need updating for the third field that we added?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

volume type will be handled separately via #217

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, configure a failure domain like below:
```yaml
- availabilityZone: "<nova availability zone>"
rootVolume:
availabilityZone: "<cinder availability zone>"
```

With these zones, the complete `failureDomains` (4 and 5) on the example above should look something like below:
```yaml
failureDomains:
platform: OpenStack
openstack:
- availabilityZone: nova-az0
rootVolume:
availabilityZone: cinder-az0
- availabilityZone: nova-az1
rootVolume:
availabilityZone: cinder-az1
- availabilityZone: nova-az2
rootVolume:
availabilityZone: cinder-az2
```

Prior to 4.14, if the masters were configured with Availability Zones (AZ), the installer (via Terraform) would create
one ServerGroup in OpenStack (the one initially created for master-0, ending with the name of the AZ) but configure
the Machine ProviderSpec with different ServerGroups, one per AZ.
So if you upgrade a cluster from a previous release to 4.14, you'll need to follow this [solution](https://access.redhat.com/solutions/7013893).

4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ require (
github.com/go-test/deep v1.1.0
github.com/golang/mock v1.6.0
github.com/golangci/golangci-lint v1.52.2
github.com/google/uuid v1.3.0
github.com/onsi/ginkgo/v2 v2.9.5
github.com/onsi/gomega v1.27.7
github.com/openshift/api v0.0.0-20230627091025-b88ff67980ac
github.com/openshift/client-go v0.0.0-20230503144108-75015d2347cb
github.com/openshift/client-go v0.0.0-20230607134213-3cd0021bbee3
github.com/openshift/cluster-api-actuator-pkg/testutils v0.0.0-20230622171654-75c6bcfa831c
github.com/openshift/library-go v0.0.0-20230523150659-ab179469ba38
github.com/spf13/pflag v1.0.5
Expand Down Expand Up @@ -97,7 +98,6 @@ require (
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/gordonklaus/ineffassign v0.0.0-20230107090616-13ace0543b28 // indirect
github.com/gostaticanalysis/analysisutil v0.7.1 // indirect
github.com/gostaticanalysis/comment v1.4.2 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,8 @@ github.com/onsi/gomega v1.27.7 h1:fVih9JD6ogIiHUN6ePK7HJidyEDpWGVB5mzM7cWNXoU=
github.com/onsi/gomega v1.27.7/go.mod h1:1p8OOlwo2iUUDsHnOrjE5UKYJ+e3W8eQ3qSlRahPmr4=
github.com/openshift/api v0.0.0-20230627091025-b88ff67980ac h1:bY6f6tb7ZUNb6Lfsm3r3SMwcDvbvGXjYV+caTnAjVRA=
github.com/openshift/api v0.0.0-20230627091025-b88ff67980ac/go.mod h1:4VWG+W22wrB4HfBL88P40DxLEpSOaiBVxUnfalfJo9k=
github.com/openshift/client-go v0.0.0-20230503144108-75015d2347cb h1:Nij5OnaECrkmcRQMAE9LMbQXPo95aqFnf+12B7SyFVI=
github.com/openshift/client-go v0.0.0-20230503144108-75015d2347cb/go.mod h1:Rhb3moCqeiTuGHAbXBOlwPubUMlOZEkrEWTRjIF3jzs=
github.com/openshift/client-go v0.0.0-20230607134213-3cd0021bbee3 h1:uVCq/Sx2y4UZh+qCsCL1BBUJpc3DULHkN4j7XHHgHtw=
github.com/openshift/client-go v0.0.0-20230607134213-3cd0021bbee3/go.mod h1:M+VUIcqx5IvgzejcbgmQnxETPrXRYlcufHpw2bAgz9Y=
github.com/openshift/cluster-api-actuator-pkg/testutils v0.0.0-20230622171654-75c6bcfa831c h1:2EpVQ7ZZIvpm3PExUIjrIHknRAfyJBr0xjUJFQjYaxA=
github.com/openshift/cluster-api-actuator-pkg/testutils v0.0.0-20230622171654-75c6bcfa831c/go.mod h1:w4P7zcu7okmBpkjKJK71rl5hp1a8RFm1NraVrxVqiUs=
github.com/openshift/library-go v0.0.0-20230523150659-ab179469ba38 h1:rKEpSwRxeQ6eN915GbcuyikwyWu//V61w5zIUWD9b2U=
Expand Down
4 changes: 2 additions & 2 deletions pkg/controllers/controlplanemachinesetgenerator/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func buildControlPlaneMachineSetAWSMachineSpec(logger logr.Logger, machines []ma
}

// buildAWSFailureDomains builds an AWS flavored FailureDomains for the ControlPlaneMachineSet.
func buildAWSFailureDomains(failureDomains *failuredomain.Set) machinev1.FailureDomains {
func buildAWSFailureDomains(failureDomains *failuredomain.Set) (machinev1.FailureDomains, error) { //nolint:unparam
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note for reviewers: in a comment with Damiano, we want consistent buildFD functions for the providers, so since OpenStack can return an actual error, we let all builders to return an error too (even if the error is nil for now).

awsFailureDomains := []machinev1.AWSFailureDomain{}

for _, fd := range failureDomains.List() {
Expand All @@ -105,5 +105,5 @@ func buildAWSFailureDomains(failureDomains *failuredomain.Set) machinev1.Failure
Platform: configv1.AWSPlatformType,
}

return cpmsFailureDomain
return cpmsFailureDomain, nil
}
4 changes: 2 additions & 2 deletions pkg/controllers/controlplanemachinesetgenerator/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func buildControlPlaneMachineSetAzureMachineSpec(logger logr.Logger, machines []
}

// buildAzureFailureDomains builds an Azure flavored FailureDomains for the ControlPlaneMachineSet.
func buildAzureFailureDomains(failureDomains *failuredomain.Set) machinev1.FailureDomains {
func buildAzureFailureDomains(failureDomains *failuredomain.Set) (machinev1.FailureDomains, error) { //nolint:unparam
azureFailureDomains := []machinev1.AzureFailureDomain{}

for _, fd := range failureDomains.List() {
Expand All @@ -91,5 +91,5 @@ func buildAzureFailureDomains(failureDomains *failuredomain.Set) machinev1.Failu
Platform: configv1.AzurePlatformType,
}

return cpmsFailureDomain
return cpmsFailureDomain, nil
}
9 changes: 9 additions & 0 deletions pkg/controllers/controlplanemachinesetgenerator/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ var (
errUnsupportedPlatform = errors.New("unsupported platform")
// errNilProviderSpec is an error used when provider spec is nil.
errNilProviderSpec = errors.New("provider spec is nil")
// errMixedEmptyFailureDomains is an error used when there are machines with different failure domains and one of them is empty.
errMixedEmptyFailureDomains = errors.New("an empty failure domain was found and other failure domains are not empty")
// errInconsistentProviderSpec is an error used when the provider specs are inconsistent.
errInconsistentProviderSpec = errors.New("provider specs are inconsistent")
)

// ControlPlaneMachineSetGeneratorReconciler reconciles a ControlPlaneMachineSet object.
Expand Down Expand Up @@ -239,6 +243,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(logger, 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