From be3b1c1186cdac68fdc7874fd66dc4dde98b767f Mon Sep 17 00:00:00 2001 From: Simon Murray Date: Mon, 30 Sep 2024 14:06:33 +0100 Subject: [PATCH] Fix Volume AZ Generation (#20) Seemingly the "default" function always expects some sane default, and does very odd things if you give it an undefined default. Instead switch to using regular conditional logic so we can guarantee the nil/nil output from the macro is nil, and we can condititionally generate the AZ code. Said AZ code has also been altered to adhere to the the new breaking CR format change. --- charts/cluster-api-cluster-openstack/Chart.yaml | 2 +- charts/cluster-api-cluster-openstack/README.md | 2 +- charts/cluster-api-cluster-openstack/templates/_helpers.tpl | 6 +++++- .../cluster-api-cluster-openstack/templates/workload.yaml | 5 ++++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/charts/cluster-api-cluster-openstack/Chart.yaml b/charts/cluster-api-cluster-openstack/Chart.yaml index c81d860..34bfabb 100644 --- a/charts/cluster-api-cluster-openstack/Chart.yaml +++ b/charts/cluster-api-cluster-openstack/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: cluster-api-cluster-openstack description: A Helm chart to deploy a Kubernetes Cluster type: application -version: v0.5.5 +version: v0.5.6 icon: https://raw.githubusercontent.com/unikorn-cloud/helm-cluster-api/main/icons/default.png diff --git a/charts/cluster-api-cluster-openstack/README.md b/charts/cluster-api-cluster-openstack/README.md index 64dfa6e..372f032 100644 --- a/charts/cluster-api-cluster-openstack/README.md +++ b/charts/cluster-api-cluster-openstack/README.md @@ -36,7 +36,7 @@ spec: source: repoURL: https://unikorn-cloud.github.io/helm-cluster-api chart: cluster-api-cluster-openstack - targetRevision: v0.5.5 + targetRevision: v0.5.6 helm: releaseName: foo # Remove the default work queue. diff --git a/charts/cluster-api-cluster-openstack/templates/_helpers.tpl b/charts/cluster-api-cluster-openstack/templates/_helpers.tpl index ea67ee9..fe8bb79 100644 --- a/charts/cluster-api-cluster-openstack/templates/_helpers.tpl +++ b/charts/cluster-api-cluster-openstack/templates/_helpers.tpl @@ -94,7 +94,11 @@ Workload failure domain. Workload volume failure domain. */}} {{- define "openstack.failureDomain.volume.workload" -}} -{{ .pool.machine.disk.failureDomain | default .values.openstack.volumeFailureDomain }} +{{- if .pool.machine.disk.failureDomain -}} +{{ .pool.machine.disk.failureDomain }} +{{- else if .values.openstack.volumeFailureDomain -}} +{{ .values.openstack.volumeFailureDomain }} +{{- end }} {{- end }} {{/* diff --git a/charts/cluster-api-cluster-openstack/templates/workload.yaml b/charts/cluster-api-cluster-openstack/templates/workload.yaml index 085521d..165e2f1 100644 --- a/charts/cluster-api-cluster-openstack/templates/workload.yaml +++ b/charts/cluster-api-cluster-openstack/templates/workload.yaml @@ -70,8 +70,11 @@ spec: {{- end }} {{- with $disk := $pool.machine.disk }} rootVolume: - availabilityZone: {{ include "openstack.failureDomain.volume.workload" $context }} sizeGiB: {{ $disk.size }} + {{- with $availabilityZone := (include "openstack.failureDomain.volume.workload" $context) }} + availabilityZone: + name: {{ $availabilityZone }} + {{- end }} {{- end }} {{- with $cluster := $.Values.cluster -}} {{- with $metadata := $cluster.serverMetadata -}}