From 540c6ddb9676143889205123437af056408f6a85 Mon Sep 17 00:00:00 2001 From: ERIK Date: Tue, 17 Dec 2024 16:38:54 +0800 Subject: [PATCH] remove legacy kubelet container pre-upgrade tasks (#11805) Signed-off-by: bo.jiang --- roles/kubernetes/node/tasks/main.yml | 5 --- roles/kubernetes/node/tasks/pre_upgrade.yml | 48 --------------------- 2 files changed, 53 deletions(-) delete mode 100644 roles/kubernetes/node/tasks/pre_upgrade.yml diff --git a/roles/kubernetes/node/tasks/main.yml b/roles/kubernetes/node/tasks/main.yml index 4e38a95a515..b8a5fcebf9b 100644 --- a/roles/kubernetes/node/tasks/main.yml +++ b/roles/kubernetes/node/tasks/main.yml @@ -5,11 +5,6 @@ - facts - kubelet -- name: Pre-upgrade kubelet - import_tasks: pre_upgrade.yml - tags: - - kubelet - - name: Ensure /var/lib/cni exists file: path: /var/lib/cni diff --git a/roles/kubernetes/node/tasks/pre_upgrade.yml b/roles/kubernetes/node/tasks/pre_upgrade.yml deleted file mode 100644 index e4bbf6b747b..00000000000 --- a/roles/kubernetes/node/tasks/pre_upgrade.yml +++ /dev/null @@ -1,48 +0,0 @@ ---- -- name: "Pre-upgrade | check if kubelet container exists" - shell: >- - set -o pipefail && - {% if container_manager in ['crio', 'docker'] %} - {{ docker_bin_dir }}/docker ps -af name=kubelet | grep kubelet - {% elif container_manager == 'containerd' %} - {{ bin_dir }}/crictl ps --all --name kubelet | grep kubelet - {% endif %} - args: - executable: /bin/bash - failed_when: false - changed_when: false - check_mode: false - register: kubelet_container_check - -- name: "Pre-upgrade | copy /var/lib/cni from kubelet" - command: >- - {% if container_manager in ['crio', 'docker'] %} - docker cp kubelet:/var/lib/cni /var/lib/cni - {% elif container_manager == 'containerd' %} - ctr run --rm --mount type=bind,src=/var/lib/cni,dst=/cnilibdir,options=rbind:rw kubelet kubelet-tmp sh -c 'cp /var/lib/cni/* /cnilibdir/' - {% endif %} - args: - creates: "/var/lib/cni" - failed_when: false - when: kubelet_container_check.rc == 0 - -- name: "Pre-upgrade | ensure kubelet container service is stopped if using host deployment" - service: - name: kubelet - state: stopped - when: kubelet_container_check.rc == 0 - -- name: "Pre-upgrade | ensure kubelet container is removed if using host deployment" - shell: >- - {% if container_manager in ['crio', 'docker'] %} - {{ docker_bin_dir }}/docker rm -fv kubelet - {% elif container_manager == 'containerd' %} - {{ bin_dir }}/crictl stop kubelet && {{ bin_dir }}/crictl rm kubelet - {% endif %} - failed_when: false - changed_when: false - register: remove_kubelet_container - retries: 4 - until: remove_kubelet_container.rc == 0 - delay: 5 - when: kubelet_container_check.rc == 0