From 612cf8f1b59bb53db379eb70214687ac5273da2b Mon Sep 17 00:00:00 2001 From: Matt Pryor Date: Wed, 1 Feb 2023 12:18:47 +0000 Subject: [PATCH] Allow Argo to prune old templates --- .../templates/control-plane/openstack-machine-template.yaml | 5 +++-- .../templates/node-group/kubeadm-config-template.yaml | 5 +++-- .../templates/node-group/openstack-machine-template.yaml | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) 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 21350fa..f4705e6 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,8 @@ 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 - # Allow Argo to clean up old templates after the cluster has become healthy again - argocd.argoproj.io/sync-options: PruneLast=true + # Allow Argo to clean up old templates by ignoring the non-controller owner references, + # but only after the cluster has become healthy again + argocd.argoproj.io/sync-options: "ControllerReferencesOnly=true,PruneLast=true" 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 35b3a5c..18c9cbd 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,9 @@ 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 - # Allow Argo to clean up old templates after the cluster has become healthy again - argocd.argoproj.io/sync-options: PruneLast=true + # Allow Argo to clean up old templates by ignoring the non-controller owner references, + # but only after the cluster has become healthy again + argocd.argoproj.io/sync-options: "ControllerReferencesOnly=true,PruneLast=true" spec: template: spec: {{ include "openstack-cluster.nodegroup.kct.spec" (list $ $nodeGroup) | nindent 6 }} 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 d07181d..46f986b 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,8 @@ 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 - # Allow Argo to clean up old templates after the cluster has become healthy again - argocd.argoproj.io/sync-options: PruneLast=true + # Allow Argo to clean up old templates by ignoring the non-controller owner references, + # but only after the cluster has become healthy again + argocd.argoproj.io/sync-options: "ControllerReferencesOnly=true,PruneLast=true" spec: {{ include "openstack-cluster.nodegroup.mt.spec" (list $ $nodeGroup) | nindent 2 }} {{- end }}