Make reset work for crio (#6812)

crio refuses to delete pods when cni is unavailable which is the
case e.g. using calico with kdd datastore. See:

https://github.com/cri-o/cri-o/issues/4084

Fix by deleting storage associated with containers. Stop and disable
crio service so switching container runtime can be done.
This commit is contained in:
Hans Feldt 2020-10-13 00:47:22 +02:00 committed by GitHub
parent 5e32655830
commit e6effb8245
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -92,6 +92,21 @@
- containerd - containerd
when: container_manager in ["crio", "containerd"] and deploy_container_engine|default(true) when: container_manager in ["crio", "containerd"] and deploy_container_engine|default(true)
- name: reset | stop and disable crio service
service:
name: crio
state: stopped
enabled: false
failed_when: false
tags: [ crio ]
when: container_manager == "crio"
- name: reset | forcefully wipe CRI-O's container and image storage
command: "crio wipe -f"
failed_when: false
tags: [ crio ]
when: container_manager == "crio"
- name: reset | stop all cri pods - name: reset | stop all cri pods
shell: "set -o pipefail && crictl pods -q | xargs -r crictl -t 60s stopp" shell: "set -o pipefail && crictl pods -q | xargs -r crictl -t 60s stopp"
args: args:
@ -100,10 +115,8 @@
retries: 5 retries: 5
until: remove_all_cri_containers.rc == 0 until: remove_all_cri_containers.rc == 0
delay: 5 delay: 5
tags: tags: [ containerd ]
- crio when: container_manager == "containerd"
- containerd
when: container_manager in ["crio", "containerd"]
- name: reset | remove all cri pods - name: reset | remove all cri pods
shell: "set -o pipefail && crictl pods -q | xargs -r crictl -t 60s rmp" shell: "set -o pipefail && crictl pods -q | xargs -r crictl -t 60s rmp"
@ -113,10 +126,8 @@
retries: 5 retries: 5
until: remove_all_cri_containers.rc == 0 until: remove_all_cri_containers.rc == 0
delay: 5 delay: 5
tags: tags: [ containerd ]
- crio when: container_manager == "containerd"
- containerd
when: container_manager in ["crio", "containerd"]
- name: reset | stop etcd services - name: reset | stop etcd services
service: service: