diff --git a/charts/openstack-cluster/README.md b/charts/openstack-cluster/README.md index cf6316f..9d1c73e 100644 --- a/charts/openstack-cluster/README.md +++ b/charts/openstack-cluster/README.md @@ -125,8 +125,7 @@ working cluster: ```yaml # The target Kubernetes version -global: - kubernetesVersion: 1.22.1 +kubernetesVersion: 1.22.1 # An image with the required software installed at the target version machineImage: ubuntu-2004-kube-v{{ .Values.kubernetesVersion }} diff --git a/charts/openstack-cluster/templates/_helpers.tpl b/charts/openstack-cluster/templates/_helpers.tpl index ca3481f..e590614 100644 --- a/charts/openstack-cluster/templates/_helpers.tpl +++ b/charts/openstack-cluster/templates/_helpers.tpl @@ -67,8 +67,8 @@ Labels for component-level resources Name of the secret containing the cloud credentials. */}} {{- define "openstack-cluster.cloudCredentialsSecretName" -}} -{{- if .Values.global.cloudCredentialsSecretName -}} -{{- .Values.global.cloudCredentialsSecretName -}} +{{- if .Values.cloudCredentialsSecretName -}} +{{- .Values.cloudCredentialsSecretName -}} {{- else -}} {{ include "openstack-cluster.componentName" (list . "cloud-credentials") -}} {{- end -}} @@ -167,7 +167,7 @@ version of the target cluster. {{- if .Values.autoscaler.image.tag -}} {{- .Values.autoscaler.image.tag -}} {{- else -}} -{{- $kubeMinorVersion := .Values.global.kubernetesVersion | splitList "." | reverse | rest | reverse | join "." -}} +{{- $kubeMinorVersion := .Values.kubernetesVersion | splitList "." | reverse | rest | reverse | join "." -}} {{- $defaultTag := printf "v%s.0" $kubeMinorVersion -}} {{- .Values.autoscaler.image.tags | dig $kubeMinorVersion $defaultTag -}} {{- end -}} 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 fab21b7..7f70190 100644 --- a/charts/openstack-cluster/templates/control-plane/kubeadm-control-plane.yaml +++ b/charts/openstack-cluster/templates/control-plane/kubeadm-control-plane.yaml @@ -17,7 +17,7 @@ option of InitConfiguration and specifying a KubeProxyConfiguration. {{- $files := index . 1 | dig "files" list }} {{- $preKubeadmCommands := index . 1 | dig "preKubeadmCommands" list }} -{{- if and $skipPhases (semverCompare "<1.22.0" $ctx.Values.global.kubernetesVersion) }} +{{- if and $skipPhases (semverCompare "<1.22.0" $ctx.Values.kubernetesVersion) }} {{- fail "skipPhases is only supported for Kubernetes 1.22 and higher" }} {{- end }} @@ -75,7 +75,7 @@ metadata: # Deleting them ourselves, which CAPI is not expecting, can cause some nasty race conditions helm.sh/resource-policy: keep spec: - version: {{ .Values.global.kubernetesVersion | required ".Values.global.kubernetesVersion is required" }} + version: {{ .Values.kubernetesVersion | required ".Values.kubernetesVersion is required" }} replicas: {{ .Values.controlPlane.machineCount }} rolloutStrategy: {{ toYaml .Values.controlPlane.rolloutStrategy | nindent 4 }} machineTemplate: diff --git a/charts/openstack-cluster/templates/node-group/machine-deployment.yaml b/charts/openstack-cluster/templates/node-group/machine-deployment.yaml index 1ebbee7..0b1aeea 100644 --- a/charts/openstack-cluster/templates/node-group/machine-deployment.yaml +++ b/charts/openstack-cluster/templates/node-group/machine-deployment.yaml @@ -44,7 +44,7 @@ spec: capi.stackhpc.com/node-group: {{ $nodeGroup.name }} spec: clusterName: {{ include "openstack-cluster.clusterName" $ }} - version: {{ $.Values.global.kubernetesVersion }} + version: {{ $.Values.kubernetesVersion }} {{- with $nodeGroup.failureDomain }} failureDomain: {{ . }} {{- end }} diff --git a/charts/openstack-cluster/templates/secret-cloud-config.yaml b/charts/openstack-cluster/templates/secret-cloud-config.yaml index f64fb09..2488b58 100644 --- a/charts/openstack-cluster/templates/secret-cloud-config.yaml +++ b/charts/openstack-cluster/templates/secret-cloud-config.yaml @@ -1,4 +1,4 @@ -{{- if not .Values.global.cloudCredentialsSecretName }} +{{- if not .Values.cloudCredentialsSecretName }} {{- $cloud := index .Values.clouds .Values.cloudName }} {{- if not (dig "auth" "project_id" nil $cloud) }} {{- fail "clouds.yaml must contain the project ID" }}