From 6bd4cd8e46bd031e0238bd6fe7c34cb36cdb79a9 Mon Sep 17 00:00:00 2001 From: Matt Pryor Date: Mon, 1 Aug 2022 17:50:23 +0100 Subject: [PATCH 1/3] Support for clusters without explicit AZs --- .../openstack-cluster/templates/cluster-openstack.yaml | 10 +++++++--- charts/openstack-cluster/templates/cluster.yaml | 2 +- .../templates/control-plane/kubeadm-control-plane.yaml | 2 +- .../control-plane/openstack-machine-template.yaml | 2 +- .../templates/node-group/machine-deployment.yaml | 6 ++++-- .../node-group/openstack-machine-template.yaml | 2 +- charts/openstack-cluster/values.yaml | 6 ++++-- 7 files changed, 19 insertions(+), 11 deletions(-) diff --git a/charts/openstack-cluster/templates/cluster-openstack.yaml b/charts/openstack-cluster/templates/cluster-openstack.yaml index 2854e9b..78ab688 100644 --- a/charts/openstack-cluster/templates/cluster-openstack.yaml +++ b/charts/openstack-cluster/templates/cluster-openstack.yaml @@ -1,5 +1,5 @@ --- -apiVersion: infrastructure.cluster.x-k8s.io/v1alpha5 +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha6 kind: OpenStackCluster metadata: name: {{ include "openstack-cluster.clusterName" . }} @@ -50,6 +50,10 @@ spec: {{- end }} apiServerPort: {{ .port }} {{- end }} - {{- with .Values.controlPlane.failureDomains }} - controlPlaneAvailabilityZones: {{ toYaml . | nindent 4 }} + {{- with .Values.controlPlane }} + {{- if .omitFailureDomain }} + controlPlaneOmitAvailabilityZone: true + {{- else if .failureDomains }} + controlPlaneAvailabilityZones: {{ toYaml .failureDomains | nindent 4 }} + {{- end }} {{- end }} diff --git a/charts/openstack-cluster/templates/cluster.yaml b/charts/openstack-cluster/templates/cluster.yaml index b851b96..98acc82 100644 --- a/charts/openstack-cluster/templates/cluster.yaml +++ b/charts/openstack-cluster/templates/cluster.yaml @@ -11,6 +11,6 @@ spec: kind: KubeadmControlPlane name: {{ include "openstack-cluster.componentName" (list . "control-plane") }} infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1alpha5 + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha6 kind: OpenStackCluster name: {{ include "openstack-cluster.clusterName" . }} diff --git a/charts/openstack-cluster/templates/control-plane/kubeadm-control-plane.yaml b/charts/openstack-cluster/templates/control-plane/kubeadm-control-plane.yaml index 568b314..522ff9e 100644 --- a/charts/openstack-cluster/templates/control-plane/kubeadm-control-plane.yaml +++ b/charts/openstack-cluster/templates/control-plane/kubeadm-control-plane.yaml @@ -83,7 +83,7 @@ spec: labels: {{ include "openstack-cluster.controlPlaneSelectorLabels" . | nindent 8 }} infrastructureRef: kind: OpenStackMachineTemplate - apiVersion: infrastructure.cluster.x-k8s.io/v1alpha5 + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha6 name: {{ include "openstack-cluster.controlplane.mt.name" . }} {{- with .Values.controlPlane.nodeDrainTimeout }} nodeDrainTimeout: {{ . }} diff --git a/charts/openstack-cluster/templates/control-plane/openstack-machine-template.yaml b/charts/openstack-cluster/templates/control-plane/openstack-machine-template.yaml index b892973..acac20a 100644 --- a/charts/openstack-cluster/templates/control-plane/openstack-machine-template.yaml +++ b/charts/openstack-cluster/templates/control-plane/openstack-machine-template.yaml @@ -40,7 +40,7 @@ template: {{- include "openstack-cluster.componentName" (list . "control-plane") }}-{{ trunc 8 $checksum }} {{- end }} -apiVersion: infrastructure.cluster.x-k8s.io/v1alpha5 +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha6 kind: OpenStackMachineTemplate metadata: name: {{ include "openstack-cluster.controlplane.mt.name" . }} diff --git a/charts/openstack-cluster/templates/node-group/machine-deployment.yaml b/charts/openstack-cluster/templates/node-group/machine-deployment.yaml index 395766c..895a46c 100644 --- a/charts/openstack-cluster/templates/node-group/machine-deployment.yaml +++ b/charts/openstack-cluster/templates/node-group/machine-deployment.yaml @@ -39,14 +39,16 @@ spec: spec: clusterName: {{ include "openstack-cluster.clusterName" $ }} version: {{ $.Values.global.kubernetesVersion }} - failureDomain: {{ $nodeGroup.failureDomain }} + {{- with $nodeGroup.failureDomain }} + failureDomain: {{ . }} + {{- end }} bootstrap: configRef: apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 kind: KubeadmConfigTemplate name: {{ include "openstack-cluster.nodegroup.kct.name" (list $ $nodeGroup) }} infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1alpha5 + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha6 kind: OpenStackMachineTemplate name: {{ include "openstack-cluster.nodegroup.mt.name" (list $ $nodeGroup) }} nodeDrainTimeout: {{ $nodeGroup.nodeDrainTimeout }} diff --git a/charts/openstack-cluster/templates/node-group/openstack-machine-template.yaml b/charts/openstack-cluster/templates/node-group/openstack-machine-template.yaml index c7fe642..bdd7209 100644 --- a/charts/openstack-cluster/templates/node-group/openstack-machine-template.yaml +++ b/charts/openstack-cluster/templates/node-group/openstack-machine-template.yaml @@ -47,7 +47,7 @@ template: {{- range $nodeGroupOverrides := .Values.nodeGroups }} {{- $nodeGroup := deepCopy $.Values.nodeGroupDefaults | mustMerge $nodeGroupOverrides }} --- -apiVersion: infrastructure.cluster.x-k8s.io/v1alpha5 +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha6 kind: OpenStackMachineTemplate metadata: name: {{ include "openstack-cluster.nodegroup.mt.name" (list $ $nodeGroup) }} diff --git a/charts/openstack-cluster/values.yaml b/charts/openstack-cluster/values.yaml index 4f677bb..9693cab 100644 --- a/charts/openstack-cluster/values.yaml +++ b/charts/openstack-cluster/values.yaml @@ -105,8 +105,10 @@ apiServer: controlPlane: # The failure domains to use for control plane nodes # If given, should be a list of availability zones - # If not given, all availability zones will be considered for control plane nodes + # Only used when omitFailureDomain = false failureDomains: + # Indicates whether the failure domain should be omitted from control plane nodes + omitFailureDomain: true # The number of control plane machines to deploy # For high-availability, this should be greater than 1 # For etcd quorum, it should be odd - usually 3, or 5 for very large clusters @@ -198,7 +200,7 @@ nodeGroupDefaults: # Indicates if the node group should be autoscaled autoscale: false # The failure domain for the node group - failureDomain: nova + failureDomain: # The flavor to use for machines in the node group machineFlavor: # The default networks and ports for worker nodes From 5b27f6bb6b0738c49838975756eeff18fcec034c Mon Sep 17 00:00:00 2001 From: Matt Pryor Date: Tue, 11 Oct 2022 13:26:58 +0100 Subject: [PATCH 2/3] [skip ci] Add warning to README --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index e6e0c5d..95da7de 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,16 @@ To list the available versions for the charts: helm search repo capi --devel --versions ``` +> **WARNING** +> +> The `openstack-cluster` chart depends on features in +> [cluster-api-provider-openstack](https://github.com/kubernetes-sigs/cluster-api-provider-openstack) +> that are merged but are not yet in a release. +> +> StackHPC maintain builds for cherry-picked versions of `cluster-api-provider-openstack` for use with +> these charts. You can find these in +> [the StackHPC fork](https://github.com/stackhpc/cluster-api-provider-openstack/releases). + Currently, the following charts are available: | Chart | Description | From 2a6a873c71d5ec8907ce64d955d9a197649202d6 Mon Sep 17 00:00:00 2001 From: Matt Pryor Date: Wed, 12 Oct 2022 12:36:37 +0100 Subject: [PATCH 3/3] Small tweaks to README --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 95da7de..77ade98 100644 --- a/README.md +++ b/README.md @@ -20,11 +20,11 @@ helm search repo capi --devel --versions > > The `openstack-cluster` chart depends on features in > [cluster-api-provider-openstack](https://github.com/kubernetes-sigs/cluster-api-provider-openstack) -> that are merged but are not yet in a release. +> that are not yet in a release. > -> StackHPC maintain builds for cherry-picked versions of `cluster-api-provider-openstack` for use with -> these charts. You can find these in -> [the StackHPC fork](https://github.com/stackhpc/cluster-api-provider-openstack/releases). +> StackHPC maintain custom builds of `cluster-api-provider-openstack` for use with these charts. +> You can find these in [the StackHPC fork](https://github.com/stackhpc/cluster-api-provider-openstack/releases) +> of `cluster-api-provider-openstack`. Currently, the following charts are available: