diff --git a/charts/openstack-cluster/templates/cluster-openstack.yaml b/charts/openstack-cluster/templates/cluster-openstack.yaml index bac2702..c6a2e58 100644 --- a/charts/openstack-cluster/templates/cluster-openstack.yaml +++ b/charts/openstack-cluster/templates/cluster-openstack.yaml @@ -4,6 +4,10 @@ kind: OpenStackCluster metadata: name: {{ include "openstack-cluster.clusterName" . }} labels: {{ include "openstack-cluster.commonLabels" . | nindent 4 }} + annotations: + # We let Cluster API clean up the cluster resources + # Deleting them ourselves, which CAPI is not expecting, can cause some nasty race conditions + helm.sh/resource-policy: keep spec: identityRef: kind: Secret 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 70b9d78..568b314 100644 --- a/charts/openstack-cluster/templates/control-plane/kubeadm-control-plane.yaml +++ b/charts/openstack-cluster/templates/control-plane/kubeadm-control-plane.yaml @@ -70,6 +70,10 @@ kind: KubeadmControlPlane metadata: name: {{ include "openstack-cluster.componentName" (list . "control-plane") }} labels: {{ include "openstack-cluster.componentLabels" (list . "control-plane") | nindent 4 }} + annotations: + # We let Cluster API clean up the cluster resources + # 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" }} replicas: {{ .Values.controlPlane.machineCount }} diff --git a/charts/openstack-cluster/templates/control-plane/machine-health-check.yaml b/charts/openstack-cluster/templates/control-plane/machine-health-check.yaml index 3993377..8000b02 100644 --- a/charts/openstack-cluster/templates/control-plane/machine-health-check.yaml +++ b/charts/openstack-cluster/templates/control-plane/machine-health-check.yaml @@ -5,6 +5,10 @@ kind: MachineHealthCheck metadata: name: {{ include "openstack-cluster.componentName" (list . "control-plane") }} labels: {{ include "openstack-cluster.componentLabels" (list . "control-plane") | nindent 4 }} + annotations: + # We let Cluster API clean up the cluster resources + # Deleting them ourselves, which CAPI is not expecting, can cause some nasty race conditions + helm.sh/resource-policy: keep spec: clusterName: {{ include "openstack-cluster.clusterName" . }} selector: 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 dd17ff1..b892973 100644 --- a/charts/openstack-cluster/templates/control-plane/openstack-machine-template.yaml +++ b/charts/openstack-cluster/templates/control-plane/openstack-machine-template.yaml @@ -47,7 +47,8 @@ metadata: labels: {{ include "openstack-cluster.componentLabels" (list . "control-plane") | nindent 4 }} annotations: capi.stackhpc.com/template-checksum: {{ include "openstack-cluster.controlplane.mt.checksum" . }} - # Ensure that the previous machine templates are kept around + # We let Cluster API clean up the cluster resources + # Deleting them ourselves, which CAPI is not expecting, can cause some nasty race conditions helm.sh/resource-policy: keep spec: {{- include "openstack-cluster.controlplane.mt.spec" . | nindent 2 }} diff --git a/charts/openstack-cluster/templates/node-group/kubeadm-config-template.yaml b/charts/openstack-cluster/templates/node-group/kubeadm-config-template.yaml index 2ce8283..176f6ec 100644 --- a/charts/openstack-cluster/templates/node-group/kubeadm-config-template.yaml +++ b/charts/openstack-cluster/templates/node-group/kubeadm-config-template.yaml @@ -38,7 +38,8 @@ metadata: labels: {{ include "openstack-cluster.nodeGroupLabels" (list $ $nodeGroup.name) | nindent 4 }} annotations: capi.stackhpc.com/template-checksum: {{ include "openstack-cluster.nodegroup.kct.checksum" (list $ $nodeGroup) }} - # Ensure that the previous templates are kept around + # We let Cluster API clean up the cluster resources + # Deleting them ourselves, which CAPI is not expecting, can cause some nasty race conditions helm.sh/resource-policy: keep spec: template: diff --git a/charts/openstack-cluster/templates/node-group/machine-deployment.yaml b/charts/openstack-cluster/templates/node-group/machine-deployment.yaml index 395766c..4525216 100644 --- a/charts/openstack-cluster/templates/node-group/machine-deployment.yaml +++ b/charts/openstack-cluster/templates/node-group/machine-deployment.yaml @@ -6,6 +6,10 @@ kind: MachineDeployment metadata: name: {{ include "openstack-cluster.componentName" (list $ $nodeGroup.name) }} labels: {{ include "openstack-cluster.nodeGroupLabels" (list $ $nodeGroup.name) | nindent 4 }} + annotations: + # We let Cluster API clean up the cluster resources + # Deleting them ourselves, which CAPI is not expecting, can cause some nasty race conditions + helm.sh/resource-policy: keep {{- if $nodeGroup.autoscale }} {{- $machineCountMin := $nodeGroup.machineCountMin | @@ -21,7 +25,6 @@ metadata: {{- if lt $machineCountMax $machineCountMin }} {{- fail (printf "maximum machine count < minimum machine count for node group '%s'" $nodeGroup.name) }} {{- end }} - annotations: cluster.x-k8s.io/cluster-api-autoscaler-node-group-min-size: {{ quote $machineCountMin }} cluster.x-k8s.io/cluster-api-autoscaler-node-group-max-size: {{ quote $machineCountMax }} {{- end }} diff --git a/charts/openstack-cluster/templates/node-group/machine-health-check.yaml b/charts/openstack-cluster/templates/node-group/machine-health-check.yaml index cee5fc6..205cfc6 100644 --- a/charts/openstack-cluster/templates/node-group/machine-health-check.yaml +++ b/charts/openstack-cluster/templates/node-group/machine-health-check.yaml @@ -7,6 +7,10 @@ kind: MachineHealthCheck metadata: name: {{ include "openstack-cluster.componentName" (list $ $nodeGroup.name) }} labels: {{ include "openstack-cluster.nodeGroupLabels" (list $ $nodeGroup.name) | nindent 4 }} + annotations: + # We let Cluster API clean up the cluster resources + # Deleting them ourselves, which CAPI is not expecting, can cause some nasty race conditions + helm.sh/resource-policy: keep spec: clusterName: {{ include "openstack-cluster.clusterName" $ }} selector: 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 1779924..c7fe642 100644 --- a/charts/openstack-cluster/templates/node-group/openstack-machine-template.yaml +++ b/charts/openstack-cluster/templates/node-group/openstack-machine-template.yaml @@ -54,7 +54,8 @@ metadata: labels: {{ include "openstack-cluster.nodeGroupLabels" (list $ $nodeGroup.name) | nindent 4 }} annotations: capi.stackhpc.com/template-checksum: {{ include "openstack-cluster.nodegroup.mt.checksum" (list $ $nodeGroup) }} - # Ensure that the previous machine templates are kept around + # We let Cluster API clean up the cluster resources + # Deleting them ourselves, which CAPI is not expecting, can cause some nasty race conditions helm.sh/resource-policy: keep spec: {{ include "openstack-cluster.nodegroup.mt.spec" (list $ $nodeGroup) | nindent 2 }} {{- end }}