c12s-kubespray/roles/kubernetes/node/tasks/pre_upgrade.yml
okamototk 4c8b93e5b9 containerd support (#4664)
* Add limited containerd support

Containerd support for Ubuntu + Calico

* Added CRI-O support for ubuntu

* containerd support.

* Reset  containerd support.

* fix lint.

* implemented feedback

* Change task name cri xx instead of cri-o in reset task and timeout condition.

* set crictl to fixed version

* Use docker-ce's container.io package for containerd.

* Add check containerd is installable or not.

* Avoid stop docker when use containerd and optimize retry for reset.

* Add config.toml.

* Fixed containerd for kubelet.env.

* Merge PR #4629

* Remove unused ubuntu variable for containerd

* Polish code for containerd and cri-o

* Refactoring cri socket configuration.

* Configurable conmon.

* Remove unused crictl/runc download

* Now crictl and runc is downloaded by common crictl.yml.

* fixed yamllint error

* Fixed brokenfiles by conflict.

* Remove commented line in config.toml

* Remove readded v1.12.x version

* Fixed broken set_docker_image_facts

* Fix yamllint errors.

* Remove unused apt source

* Fix crictl could not be installed

* Add containerd config from skolekonov's PR #4601
2019-06-29 14:09:20 -07:00

44 lines
1.5 KiB
YAML

---
- name: "Pre-upgrade | check if kubelet container exists"
shell: >-
{% if container_manager in ['crio', 'docker', 'rkt'] %}
docker ps -af name=kubelet | grep kubelet
{% elif container_manager == 'containerd' %}
crictl ps --all --name kubelet | grep kubelet
{% endif %}
failed_when: false
changed_when: false
register: kubelet_container_check
- name: "Pre-upgrade | copy /var/lib/cni from kubelet"
command: >-
{% if container_manager in ['crio', 'docker', 'rkt'] %}
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', 'rkt'] %}
docker rm -fv kubelet
{% elif container_manager == 'containerd' %}
crictl stop kubelet && 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