fix: only force delete Cilium HelmChart if it exists
Signed-off-by: Devin Buhl <devin@buhl.casa>
This commit is contained in:
1 file changed
+11
-3
@@ -36,13 +36,13 @@
|
|||||||
check_mode: false
|
check_mode: false
|
||||||
ansible.builtin.command: |-
|
ansible.builtin.command: |-
|
||||||
git rev-parse --show-toplevel
|
git rev-parse --show-toplevel
|
||||||
register: repo_abs_path
|
register: repository_path
|
||||||
|
|
||||||
- name: Copy kubeconfig project directory
|
- name: Copy kubeconfig project directory
|
||||||
run_once: true
|
run_once: true
|
||||||
ansible.builtin.fetch:
|
ansible.builtin.fetch:
|
||||||
src: "/etc/rancher/k3s/k3s.yaml"
|
src: "/etc/rancher/k3s/k3s.yaml"
|
||||||
dest: "{{ repo_abs_path.stdout }}/kubeconfig"
|
dest: "{{ repository_path.stdout }}/kubeconfig"
|
||||||
flat: true
|
flat: true
|
||||||
when:
|
when:
|
||||||
- k3s_control_node is defined
|
- k3s_control_node is defined
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
become: false
|
become: false
|
||||||
run_once: true
|
run_once: true
|
||||||
ansible.builtin.replace:
|
ansible.builtin.replace:
|
||||||
path: "{{ repo_abs_path.stdout }}/kubeconfig"
|
path: "{{ repository_path.stdout }}/kubeconfig"
|
||||||
regexp: "https://127.0.0.1:6443"
|
regexp: "https://127.0.0.1:6443"
|
||||||
replace: "https://{{ k3s_registration_address }}:6443"
|
replace: "https://{{ k3s_registration_address }}:6443"
|
||||||
|
|
||||||
@@ -115,7 +115,15 @@
|
|||||||
kind: HelmChart
|
kind: HelmChart
|
||||||
namespace: kube-system
|
namespace: kube-system
|
||||||
state: absent
|
state: absent
|
||||||
|
- name: 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: Remove finializers on the Cilium HelmChart
|
- name: Remove finializers on the Cilium HelmChart
|
||||||
|
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
|
||||||
|
|||||||
Reference in new issue
Block a user