From d74d180c09f8746c182c7e4db9d706859dcbc431 Mon Sep 17 00:00:00 2001 From: ERIK Date: Thu, 8 Oct 2026 20:17:58 +0800 Subject: [PATCH] reset: unmount calico cgroup2 fs before deleting /run/calico (#13592) Signed-off-by: bo.jiang --- roles/network_plugin/calico/tasks/reset.yml | 15 +++++++++++++++ roles/reset/tasks/main.yml | 6 ++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/roles/network_plugin/calico/tasks/reset.yml b/roles/network_plugin/calico/tasks/reset.yml index 16c850977..a82599330 100644 --- a/roles/network_plugin/calico/tasks/reset.yml +++ b/roles/network_plugin/calico/tasks/reset.yml @@ -28,3 +28,18 @@ args: executable: /bin/bash changed_when: false + +# The calico-node -init container mounts the root cgroup2 fs here, so it must be unmounted before removal +- name: Reset | unmount calico cgroup2 filesystem + ansible.posix.mount: + path: /run/calico/cgroup + state: unmounted + tags: + - files + +- name: Reset | delete calico runtime directory + file: + path: /run/calico + state: absent + tags: + - files diff --git a/roles/reset/tasks/main.yml b/roles/reset/tasks/main.yml index c23f44f7e..33293204f 100644 --- a/roles/reset/tasks/main.yml +++ b/roles/reset/tasks/main.yml @@ -384,7 +384,6 @@ - /var/lib/kube-router - /var/lib/calico - /etc/cilium - - /run/calico - /etc/bash_completion.d/kubectl.sh - /etc/bash_completion.d/crictl - /etc/bash_completion.d/nerdctl @@ -437,10 +436,13 @@ include_role: name: "network_plugin/{{ kube_network_plugin }}" tasks_from: reset + apply: + tags: + - network when: - kube_network_plugin in ['flannel', 'cilium', 'kube-router', 'calico'] tags: - - network + - always - name: Reset | Restart network when: