diff --git a/roles/container-engine/cri-o/defaults/main.yml b/roles/container-engine/cri-o/defaults/main.yml index 5ded3c64e..7ab8e04b3 100644 --- a/roles/container-engine/cri-o/defaults/main.yml +++ b/roles/container-engine/cri-o/defaults/main.yml @@ -77,3 +77,7 @@ crun_runtime: # When this is true, CRI-O package repositories are added. Set this to false when using an # environment with preconfigured CRI-O package repositories. crio_add_repos: true + +# skopeo need for save/load images when download_run_once=true +skopeo_packages: + - "skopeo" diff --git a/roles/container-engine/cri-o/tasks/main.yaml b/roles/container-engine/cri-o/tasks/main.yaml index 09425f670..187d3074e 100644 --- a/roles/container-engine/cri-o/tasks/main.yaml +++ b/roles/container-engine/cri-o/tasks/main.yaml @@ -73,6 +73,13 @@ dest: /etc/crio/crio.conf register: config_install +- name: Add skopeo pkg to install + set_fact: + crio_packages: "{{ crio_packages + skopeo_packages }}" + when: + - not skip_downloads|default(false) + - download_run_once + - name: Install cri-o packages package: name: "{{ item }}" diff --git a/roles/download/tasks/set_container_facts.yml b/roles/download/tasks/set_container_facts.yml index b793584c7..af89ba100 100644 --- a/roles/download/tasks/set_container_facts.yml +++ b/roles/download/tasks/set_container_facts.yml @@ -22,13 +22,24 @@ image_path_cached: "{{ download_cache_dir }}/images/{{ image_filename }}" image_path_final: "{{ local_release_dir }}/images/{{ image_filename }}" -- name: Set image save/load command for containerd and crio +- name: Set image save/load command for containerd set_fact: image_save_command: "{{ containerd_bin_dir }}/ctr -n k8s.io image export {{ image_path_final }} {{ image_reponame }}" image_load_command: "{{ containerd_bin_dir }}/ctr -n k8s.io image import --base-name {{ download.repo }} {{ image_path_final }}" when: container_manager == 'containerd' -- name: Set image save/load command for containerd and crio on localhost +- name: Set image save/load command for crio + set_fact: + image_save_command: "skopeo copy containers-storage:{{ image_reponame }} docker-archive:{{ image_path_final }}" + image_load_command: "skopeo copy docker-archive:{{ image_path_final }} containers-storage:{{ image_reponame }}" + when: container_manager == 'crio' + +- name: Set image save/load command for containerd on localhost set_fact: image_save_command_on_localhost: "{{ containerd_bin_dir }}/ctr -n k8s.io image export {{ image_path_cached }} {{ image_reponame }}" when: container_manager_on_localhost == 'containerd' + +- name: Set image save/load command for crio on localhost + set_fact: + image_save_command_on_localhost: "skopeo copy containers-storage:{{ image_reponame }} docker-archive:{{ image_path_final }}" + when: container_manager_on_localhost == 'crio' diff --git a/roles/kubernetes/preinstall/tasks/0020-verify-settings.yml b/roles/kubernetes/preinstall/tasks/0020-verify-settings.yml index 59ee7ee68..a2db1d993 100644 --- a/roles/kubernetes/preinstall/tasks/0020-verify-settings.yml +++ b/roles/kubernetes/preinstall/tasks/0020-verify-settings.yml @@ -280,12 +280,6 @@ msg: "download_localhost requires enable download_run_once" when: download_localhost -- name: Stop if download_localhost is enabled when container_manager not docker - assert: - that: container_manager in ['containerd', 'docker'] - msg: "download_run_once support only for docker or containerd" - when: download_run_once or download_force_cache - - name: Stop if kata_containers_enabled is enabled when container_manager is docker assert: that: container_manager != 'docker' diff --git a/tests/files/packet_centos7-crio.yml b/tests/files/packet_centos7-crio.yml index 7565f77bd..e6460e7cd 100644 --- a/tests/files/packet_centos7-crio.yml +++ b/tests/files/packet_centos7-crio.yml @@ -8,6 +8,8 @@ deploy_netchecker: true dns_min_replicas: 1 container_manager: crio +download_localhost: false +download_run_once: true + # CRI-O requirements -download_container: false etcd_deployment_type: host diff --git a/tests/files/packet_ubuntu18-crio.yml b/tests/files/packet_ubuntu18-crio.yml index a4c60d3af..2cd78739a 100644 --- a/tests/files/packet_ubuntu18-crio.yml +++ b/tests/files/packet_ubuntu18-crio.yml @@ -8,6 +8,8 @@ deploy_netchecker: true dns_min_replicas: 1 container_manager: crio +download_localhost: false +download_run_once: true + # CRI-O requirements -download_container: false etcd_deployment_type: host