diff --git a/charts/openstack-cluster/templates/cluster-openstack.yaml b/charts/openstack-cluster/templates/cluster-openstack.yaml index 2ac48c1..d0e7560 100644 --- a/charts/openstack-cluster/templates/cluster-openstack.yaml +++ b/charts/openstack-cluster/templates/cluster-openstack.yaml @@ -8,8 +8,7 @@ metadata: # We let Cluster API clean up this resource # Deleting it ourselves, which CAPI is not expecting, can cause some nasty race conditions helm.sh/resource-policy: keep - # Same, but for Argo - argocd.argoproj.io/sync-options: Prune=false + # NOTE: Argo won't delete this object itself as it has an owner reference to the cluster 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 975b257..57ee9a2 100644 --- a/charts/openstack-cluster/templates/control-plane/kubeadm-control-plane.yaml +++ b/charts/openstack-cluster/templates/control-plane/kubeadm-control-plane.yaml @@ -74,8 +74,7 @@ metadata: # We let Cluster API clean up the control plane resource # Deleting it ourselves, which CAPI is not expecting, can cause some nasty race conditions helm.sh/resource-policy: keep - # Same, but for Argo - argocd.argoproj.io/sync-options: Prune=false + # NOTE: Argo won't delete this object itself as it has an owner reference to the cluster spec: version: v{{ .Values.kubernetesVersion | required ".Values.kubernetesVersion is required" | trimPrefix "v" }} 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 aa1138a..c21d769 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,9 @@ kind: MachineHealthCheck metadata: name: {{ include "openstack-cluster.componentName" (list . "control-plane") }} labels: {{ include "openstack-cluster.componentLabels" (list . "control-plane") | nindent 4 }} + annotations: + # Argo should manage this resource even though it has an owner ref for the cluster + argocd.argoproj.io/managed-resource: "true" 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 2093159..aa5dcac 100644 --- a/charts/openstack-cluster/templates/control-plane/openstack-machine-template.yaml +++ b/charts/openstack-cluster/templates/control-plane/openstack-machine-template.yaml @@ -50,7 +50,6 @@ metadata: # Cluster API complains when old templates disappear before it has rolled all the machines over # When deploying with Helm, leave the resource behind and let Cluster API clean it up helm.sh/resource-policy: keep - # For Argo, we can do better and make sure it is removed only once the cluster becomes healthy again - argocd.argoproj.io/sync-options: PruneLast=true + # NOTE: Argo won't delete this object itself as it has an owner reference to the cluster 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 34045fc..165b19d 100644 --- a/charts/openstack-cluster/templates/node-group/kubeadm-config-template.yaml +++ b/charts/openstack-cluster/templates/node-group/kubeadm-config-template.yaml @@ -43,8 +43,7 @@ metadata: # Cluster API complains when old templates disappear before it has rolled all the machines over # When deploying with Helm, leave the resource behind and let Cluster API clean it up helm.sh/resource-policy: keep - # For Argo, we can do better and make sure it is removed only once the cluster becomes healthy again - argocd.argoproj.io/sync-options: PruneLast=true + # NOTE: Argo won't delete this object itself as it has an owner reference to the cluster spec: template: spec: {{ include "openstack-cluster.nodegroup.kct.spec" (list $ $nodeGroup) | nindent 6 }} diff --git a/charts/openstack-cluster/templates/node-group/machine-deployment.yaml b/charts/openstack-cluster/templates/node-group/machine-deployment.yaml index dfa2b08..0370ec9 100644 --- a/charts/openstack-cluster/templates/node-group/machine-deployment.yaml +++ b/charts/openstack-cluster/templates/node-group/machine-deployment.yaml @@ -24,6 +24,8 @@ metadata: {{- fail (printf "maximum machine count < minimum machine count for node group '%s'" $nodeGroup.name) }} {{- end }} annotations: + # Argo should manage this resource even though it has an owner ref for the cluster + argocd.argoproj.io/managed-resource: "true" 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 1e23a64..5bee2d2 100644 --- a/charts/openstack-cluster/templates/node-group/machine-health-check.yaml +++ b/charts/openstack-cluster/templates/node-group/machine-health-check.yaml @@ -9,6 +9,9 @@ metadata: labels: {{- include "openstack-cluster.componentLabels" (list $ "worker") | nindent 4 }} {{ $.Values.projectPrefix }}/node-group: {{ $nodeGroup.name }} + annotations: + # Argo should manage this resource even though it has an owner ref for the cluster + argocd.argoproj.io/managed-resource: "true" 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 6e4029f..aebdfa0 100644 --- a/charts/openstack-cluster/templates/node-group/openstack-machine-template.yaml +++ b/charts/openstack-cluster/templates/node-group/openstack-machine-template.yaml @@ -59,7 +59,6 @@ metadata: # Cluster API complains when old templates disappear before it has rolled all the machines over # When deploying with Helm, leave the resource behind and let Cluster API clean it up helm.sh/resource-policy: keep - # For Argo, we can do better and make sure it is removed only once the cluster becomes healthy again - argocd.argoproj.io/sync-options: PruneLast=true + # NOTE: Argo won't delete this object itself as it has an owner reference to the cluster spec: {{ include "openstack-cluster.nodegroup.mt.spec" (list $ $nodeGroup) | nindent 2 }} {{- end }} diff --git a/charts/openstack-cluster/templates/secret-cloud-config.yaml b/charts/openstack-cluster/templates/secret-cloud-config.yaml index 811641d..aeb6783 100644 --- a/charts/openstack-cluster/templates/secret-cloud-config.yaml +++ b/charts/openstack-cluster/templates/secret-cloud-config.yaml @@ -13,8 +13,8 @@ metadata: # If the cloud credentials are deleted before the cluster has finished deleting, then the cluster # deletion cannot proceed any further. So prevent Helm from deleting it. helm.sh/resource-policy: keep - # Same, but for Argo - argocd.argoproj.io/sync-options: Prune=false + # For Argo, this resource should be pruned last out of everything + argocd.argoproj.io/sync-options: PruneLast=true stringData: # Just include the data for the cloud we will be using clouds.yaml: |