Download once for crio (#6998)

* download run once feature for CRI-O

* fix typo

* fix test
pull/7075/head
Sergey 2020-12-21 12:54:25 +03:00 committed by GitHub
parent 7d7739e031
commit 096bcdd078
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 30 additions and 10 deletions

View File

@ -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"

View File

@ -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 }}"

View File

@ -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'

View File

@ -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'

View File

@ -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

View File

@ -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