fix(ansible): in the case of cluster-installation playbook failure still clean up helmchart resources on next run

Signed-off-by: Devin Buhl <devin@buhl.casa>
This commit is contained in:
Devin Buhl committed 2023-07-10 13:33:20 -04:00
1 parent 73f53d2fca
commit 4fbcba348f
3 files changed
+26 -26

No files matched your search

+2 -8
View File
@@ -54,17 +54,11 @@
- { name: servicemonitors.monitoring.coreos.com, kind: CustomResourceDefinition } - { name: servicemonitors.monitoring.coreos.com, kind: CustomResourceDefinition }
- name: Coredns - name: Coredns
when: when: k3s_primary_control_node
- k3s_primary_control_node
- (k3s_server_manifests_templates | length > 0
or k3s_server_manifests_urls | length > 0)
ansible.builtin.include_tasks: tasks/coredns.yaml ansible.builtin.include_tasks: tasks/coredns.yaml
- name: Cilium - name: Cilium
when: when: k3s_primary_control_node
- k3s_primary_control_node
- (k3s_server_manifests_templates | length > 0
or k3s_server_manifests_urls | length > 0)
ansible.builtin.include_tasks: tasks/cilium.yaml ansible.builtin.include_tasks: tasks/cilium.yaml
- name: Cruft - name: Cruft
+11 -8
View File
@@ -1,7 +1,16 @@
--- ---
- name: Cilium - name: Cilium
block: block:
- name: Cilium | Check if Cilium HelmChart exists
kubernetes.core.k8s_info:
kubeconfig: /etc/rancher/k3s/k3s.yaml
name: cilium
kind: HelmChart
namespace: kube-system
register: cilium_helmchart
- name: Cilium | Wait for Cilium to rollout - name: Cilium | Wait for Cilium to rollout
when: cilium_helmchart.resources | count > 0
kubernetes.core.k8s_info: kubernetes.core.k8s_info:
kubeconfig: /etc/rancher/k3s/k3s.yaml kubeconfig: /etc/rancher/k3s/k3s.yaml
name: helm-install-cilium name: helm-install-cilium
@@ -14,6 +23,7 @@
wait_timeout: 360 wait_timeout: 360
- name: Cilium | Patch the Cilium HelmChart to unmanage it - name: Cilium | Patch the Cilium HelmChart to unmanage it
when: cilium_helmchart.resources | count > 0
kubernetes.core.k8s_json_patch: kubernetes.core.k8s_json_patch:
kubeconfig: /etc/rancher/k3s/k3s.yaml kubeconfig: /etc/rancher/k3s/k3s.yaml
name: cilium name: cilium
@@ -25,6 +35,7 @@
value: "true" value: "true"
- name: Cilium | Delete the Cilium HelmChart CR - name: Cilium | Delete the Cilium HelmChart CR
when: cilium_helmchart.resources | count > 0
kubernetes.core.k8s: kubernetes.core.k8s:
kubeconfig: /etc/rancher/k3s/k3s.yaml kubeconfig: /etc/rancher/k3s/k3s.yaml
name: cilium name: cilium
@@ -32,14 +43,6 @@
namespace: kube-system namespace: kube-system
state: absent state: absent
- name: Cilium | Check if Cilium HelmChart was deleted
kubernetes.core.k8s_info:
kubeconfig: /etc/rancher/k3s/k3s.yaml
name: cilium
kind: HelmChart
namespace: kube-system
register: cilium_helmchart
- name: Cilium | Force delete the Cilium HelmChart - name: Cilium | Force delete the Cilium HelmChart
when: cilium_helmchart.resources | count > 0 when: cilium_helmchart.resources | count > 0
kubernetes.core.k8s: kubernetes.core.k8s:
+13 -10
View File
@@ -1,7 +1,16 @@
--- ---
- name: Coredns - name: Coredns
block: block:
- name: Coredns | Check if Coredns HelmChart exists
kubernetes.core.k8s_info:
kubeconfig: /etc/rancher/k3s/k3s.yaml
name: coredns
kind: HelmChart
namespace: kube-system
register: coredns_helmchart
- name: Coredns | Wait for Coredns to rollout - name: Coredns | Wait for Coredns to rollout
when: coredns_helmchart.resources | count > 0
kubernetes.core.k8s_info: kubernetes.core.k8s_info:
kubeconfig: /etc/rancher/k3s/k3s.yaml kubeconfig: /etc/rancher/k3s/k3s.yaml
name: helm-install-coredns name: helm-install-coredns
@@ -14,6 +23,7 @@
wait_timeout: 360 wait_timeout: 360
- name: Coredns | Patch the Coredns HelmChart to unmanage it - name: Coredns | Patch the Coredns HelmChart to unmanage it
when: coredns_helmchart.resources | count > 0
kubernetes.core.k8s_json_patch: kubernetes.core.k8s_json_patch:
kubeconfig: /etc/rancher/k3s/k3s.yaml kubeconfig: /etc/rancher/k3s/k3s.yaml
name: coredns name: coredns
@@ -24,7 +34,8 @@
path: /metadata/annotations/helmcharts.helm.cattle.io~1unmanaged path: /metadata/annotations/helmcharts.helm.cattle.io~1unmanaged
value: "true" value: "true"
- name: Coredns | Delete the Cilium HelmChart CR - name: Coredns | Delete the Coredns HelmChart CR
when: coredns_helmchart.resources | count > 0
kubernetes.core.k8s: kubernetes.core.k8s:
kubeconfig: /etc/rancher/k3s/k3s.yaml kubeconfig: /etc/rancher/k3s/k3s.yaml
name: coredns name: coredns
@@ -32,15 +43,7 @@
namespace: kube-system namespace: kube-system
state: absent state: absent
- name: Coredns | Check if Cilium HelmChart was deleted - name: Coredns | Force delete the Coredns HelmChart
kubernetes.core.k8s_info:
kubeconfig: /etc/rancher/k3s/k3s.yaml
name: coredns
kind: HelmChart
namespace: kube-system
register: coredns_helmchart
- name: Coredns | Force delete the Cilium HelmChart
when: coredns_helmchart.resources | count > 0 when: coredns_helmchart.resources | count > 0
kubernetes.core.k8s: kubernetes.core.k8s:
kubeconfig: /etc/rancher/k3s/k3s.yaml kubeconfig: /etc/rancher/k3s/k3s.yaml