Skip to content

Commit

Permalink
Fix containerd install for fcos (kubernetes-sigs#8107)
Browse files Browse the repository at this point in the history
* Fix containerd install for fcos

* rm orphaned runc and containerd binaries
  • Loading branch information
mafn authored and sakuraiyuta committed Apr 16, 2022
1 parent 8d5c3c0 commit c5ae341
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
13 changes: 13 additions & 0 deletions roles/container-engine/containerd/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,19 @@
- --strip-components=1
notify: restart containerd

- name: containerd | Remove orphaned binary
file:
path: "/usr/bin/{{ item }}"
state: absent
when: containerd_bin_dir != "/usr/bin"
ignore_errors: true # noqa ignore-errors
with_items:
- containerd
- containerd-shim
- containerd-shim-runc-v1
- containerd-shim-runc-v2
- ctr

- name: containerd | Generate systemd service for containerd
template:
src: containerd.service.j2
Expand Down
2 changes: 1 addition & 1 deletion roles/container-engine/runc/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---

runc_bin_dir: /usr/bin/
runc_bin_dir: "{{ bin_dir }}"

runc_package_name: runc
13 changes: 13 additions & 0 deletions roles/container-engine/runc/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
---
- name: runc | set is_ostree
set_fact:
is_ostree: "{{ ostree.stat.exists }}"

- name: runc | Uninstall runc package managed by package manager
package:
name: "{{ runc_package_name }}"
state: absent
when:
- not (is_ostree or (ansible_distribution == "Flatcar Container Linux by Kinvolk") or (ansible_distribution == "Flatcar"))

- name: runc | Download runc binary
include_tasks: "../../../download/tasks/download_file.yml"
Expand All @@ -15,3 +21,10 @@
dest: "{{ runc_bin_dir }}/runc"
mode: 0755
remote_src: true

- name: runc | Remove orphaned binary
file:
path: /usr/bin/runc
state: absent
when: runc_bin_dir != "/usr/bin"
ignore_errors: true # noqa ignore-errors
2 changes: 1 addition & 1 deletion roles/kubespray-defaults/defaults/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ haproxy_config_dir: "/etc/haproxy"
# Directory where the binaries will be installed
bin_dir: /usr/local/bin
docker_bin_dir: /usr/bin
containerd_bin_dir: /usr/bin
containerd_bin_dir: "{{ bin_dir }}"
etcd_data_dir: /var/lib/etcd
# Where the binaries will be downloaded.
# Note: ensure that you've enough disk space (about 1G)
Expand Down

0 comments on commit c5ae341

Please sign in to comment.