containerd: properly pull images with containerd specific tools (#8245)

This commit is contained in:
Cristian Calin 2021-11-30 10:48:56 +02:00 committed by GitHub
parent 279808b44e
commit 3431ed9857
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 6 deletions

View file

@ -13,11 +13,17 @@
image_info_command: "{{ docker_bin_dir }}/docker images -q | xargs -i {{ '{{' }} docker_bin_dir }}/docker inspect -f {% raw %}'{{ '{{' }} if .RepoTags }}{{ '{{' }} join .RepoTags \",\" }}{{ '{{' }} end }}{{ '{{' }} if .RepoDigests }},{{ '{{' }} join .RepoDigests \",\" }}{{ '{{' }} end }}' {% endraw %} {} | tr '\n' ','" image_info_command: "{{ docker_bin_dir }}/docker images -q | xargs -i {{ '{{' }} docker_bin_dir }}/docker inspect -f {% raw %}'{{ '{{' }} if .RepoTags }}{{ '{{' }} join .RepoTags \",\" }}{{ '{{' }} end }}{{ '{{' }} if .RepoDigests }},{{ '{{' }} join .RepoDigests \",\" }}{{ '{{' }} end }}' {% endraw %} {} | tr '\n' ','"
when: container_manager == 'docker' when: container_manager == 'docker'
- name: prep_download | Set image pull/info command for containerd and crio - name: prep_download | Set image pull/info command for containerd
set_fact:
image_info_command: "{{ bin_dir }}/ctr -n k8s.io images ls | awk '/application/ {print $1}' | grep -v ^sha | tr '\n' ','"
image_pull_command: "{{ bin_dir }}/ctr -n k8s.io images pull --platform linux/{{ image_arch }}"
when: container_manager == 'containerd'
- name: prep_download | Set image pull/info command for crio
set_fact: set_fact:
image_info_command: "{{ bin_dir }}/crictl images --verbose | awk -F ': ' '/RepoTags|RepoDigests/ {print $2}' | tr '\n' ','" image_info_command: "{{ bin_dir }}/crictl images --verbose | awk -F ': ' '/RepoTags|RepoDigests/ {print $2}' | tr '\n' ','"
image_pull_command: "{{ bin_dir }}/crictl pull" image_pull_command: "{{ bin_dir }}/crictl pull"
when: container_manager in ['crio' ,'containerd'] when: container_manager == 'crio'
- name: prep_download | Set image pull/info command for docker on localhost - name: prep_download | Set image pull/info command for docker on localhost
set_fact: set_fact:
@ -25,11 +31,17 @@
image_info_command_on_localhost: "{{ docker_bin_dir }}/docker images" image_info_command_on_localhost: "{{ docker_bin_dir }}/docker images"
when: container_manager_on_localhost == 'docker' when: container_manager_on_localhost == 'docker'
- name: prep_download | Set image pull/info command for containerd and crio on localhost - name: prep_download | Set image pull/info command for containerd on localhost
set_fact:
image_info_command_on_localhost: "{{ bin_dir }}/ctr -n k8s.io images ls | awk '/application/ {print $1}' | grep -v ^sha | tr '\n' ','"
image_pull_command_on_localhost: "{{ bin_dir }}/ctr -n k8s.io images pull --platform linux/{{ image_arch }}"
when: container_manager_on_localhost == 'containerd'
- name: prep_download | Set image pull/info command for crio on localhost
set_fact: set_fact:
image_info_command_on_localhost: "{{ bin_dir }}/crictl images --verbose | awk -F ': ' '/RepoTags|RepoDigests/ {print $2}' | tr '\n' ','" image_info_command_on_localhost: "{{ bin_dir }}/crictl images --verbose | awk -F ': ' '/RepoTags|RepoDigests/ {print $2}' | tr '\n' ','"
image_pull_command_on_localhost: "{{ bin_dir }}/crictl pull" image_pull_command_on_localhost: "{{ bin_dir }}/crictl pull"
when: container_manager_on_localhost in ['crio' ,'containerd'] when: container_manager_on_localhost == 'crio'
- name: prep_download | On localhost, check if passwordless root is possible - name: prep_download | On localhost, check if passwordless root is possible
command: "true" command: "true"

View file

@ -29,7 +29,7 @@
- name: Set image save/load command for containerd - name: Set image save/load command for containerd
set_fact: set_fact:
image_save_command: "{{ containerd_bin_dir }}/ctr -n k8s.io image export {{ image_path_final }} {{ image_reponame }}" image_save_command: "{{ containerd_bin_dir }}/ctr -n k8s.io image export --platform linux/{{ image_arch }} {{ image_path_final }} {{ image_reponame }}"
image_load_command: "{{ containerd_bin_dir }}/ctr -n k8s.io image import --base-name {{ download.repo }} {{ image_path_final }}" image_load_command: "{{ containerd_bin_dir }}/ctr -n k8s.io image import --base-name {{ download.repo }} {{ image_path_final }}"
when: container_manager == 'containerd' when: container_manager == 'containerd'
@ -46,7 +46,7 @@
- name: Set image save/load command for containerd on localhost - name: Set image save/load command for containerd on localhost
set_fact: set_fact:
image_save_command_on_localhost: "{{ containerd_bin_dir }}/ctr -n k8s.io image export {{ image_path_cached }} {{ image_reponame }}" image_save_command_on_localhost: "{{ containerd_bin_dir }}/ctr -n k8s.io image export --platform linux/{{ image_arch }} {{ image_path_cached }} {{ image_reponame }}"
when: container_manager_on_localhost == 'containerd' when: container_manager_on_localhost == 'containerd'
- name: Set image save/load command for crio on localhost - name: Set image save/load command for crio on localhost