Skip to content

Commit 18234ed

Browse files
committed
Fix Argo Deletion Again
According to argoproj/argo-cd#12376 waves don't actually work properly for deletion. I can see in the code it does a reverse sort and picks off the largest wave first, but I guess there's a bug where it'll kick off the next wave before the first has actually deleted (or something to that effect). However, we can tell argo not to delete something and let CAPI do its own thing, which appears to work more reliably. Anecdotally, the secret at wave -1 still gets deleted last, which defies all logic and tells some something kinda works in some situations and not others!!
1 parent b4216cd commit 18234ed

File tree

4 files changed

+18
-12
lines changed

4 files changed

+18
-12
lines changed

charts/cluster-api-cluster-openstack/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ apiVersion: v2
22
name: cluster-api-cluster-openstack
33
description: A Helm chart to deploy a Kubernetes Cluster
44
type: application
5-
version: v0.3.14
5+
version: v0.3.15
66
icon: https://raw.githubusercontent.com/eschercloudai/helm-cluster-api/main/icons/default.png

charts/cluster-api-cluster-openstack/templates/cluster.yaml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,6 @@ metadata:
55
name: {{ .Release.Name }}
66
labels:
77
{{- include "openstackcluster.labels" . | nindent 4 }}
8-
annotations:
9-
# If we just delete all the things, I believe there is a race where
10-
# CAPO blows away the cluster infrastructure before it has a chance
11-
# to delete the machines, and we get into a deadlock state. By
12-
# provisioning the cluster last, and deleting it first, we should be
13-
# able to let CAPI take care of its own ordering.
14-
argocd.argoproj.io/sync-wave: "1"
158
spec:
169
clusterNetwork:
1710
pods:
@@ -40,6 +33,9 @@ metadata:
4033
name: {{ .Release.Name }}
4134
labels:
4235
{{- include "openstackcluster.labels" . | nindent 4 }}
36+
annotations:
37+
# Let CAPO do this in its chosen order.
38+
argocd.argoproj.io/sync-options: Delete=false
4339
spec:
4440
cloudName: {{ .Values.openstack.cloud }}
4541
identityRef:

charts/cluster-api-cluster-openstack/templates/control-plane.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ metadata:
55
name: "{{ .Release.Name }}-control-plane"
66
labels:
77
{{- include "openstackcluster.labels" . | nindent 4 }}
8+
annotations:
9+
# Let CAPO do this in its chosen order.
10+
argocd.argoproj.io/sync-options: Delete=false
811
spec:
912
version: "{{ .Values.controlPlane.version }}"
1013
replicas: {{ .Values.controlPlane.replicas }}
@@ -62,6 +65,9 @@ metadata:
6265
name: {{ .Release.Name }}-control-plane-{{ include "openstack.discriminator.control-plane" . }}
6366
labels:
6467
{{- include "openstackcluster.labels" . | nindent 4 }}
68+
annotations:
69+
# Let CAPO do this in its chosen order.
70+
argocd.argoproj.io/sync-options: Delete=false
6571
spec:
6672
template:
6773
spec:

charts/cluster-api-cluster-openstack/templates/workload.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@ metadata:
2020
labels:
2121
{{- include "openstackcluster.labels" $ | nindent 4 }}
2222
annotations:
23-
# See comment in cluster.yaml. ArgoCD has some smarts that monitor
24-
# the status of Cluster/Machine/MachineDeployment, so we need to
25-
# provision this after any referenced templates.
26-
argocd.argoproj.io/sync-wave: "2"
23+
# Let CAPO do this in its chosen order.
24+
argocd.argoproj.io/sync-options: Delete=false
2725
{{- include "openstackcluster.autoscalingAnnotations" $pool | nindent 4 }}
2826
spec:
2927
clusterName: "{{ $.Release.Name }}"
@@ -53,6 +51,9 @@ metadata:
5351
name: {{ $pool_name_discriminated }}
5452
labels:
5553
{{- include "openstackcluster.labels" $ | nindent 4 }}
54+
annotations:
55+
# Let CAPO do this in its chosen order.
56+
argocd.argoproj.io/sync-options: Delete=false
5657
spec:
5758
template:
5859
spec:
@@ -77,6 +78,9 @@ metadata:
7778
name: {{ $pool_name_discriminated }}
7879
labels:
7980
{{- include "openstackcluster.labels" $ | nindent 4 }}
81+
annotations:
82+
# Let CAPO do this in its chosen order.
83+
argocd.argoproj.io/sync-options: Delete=false
8084
spec:
8185
template:
8286
spec:

0 commit comments

Comments
 (0)