Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Download once for crio #6998

Merged
merged 3 commits into from
Dec 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions roles/container-engine/cri-o/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
7 changes: 7 additions & 0 deletions roles/container-engine/cri-o/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand Down
15 changes: 13 additions & 2 deletions roles/download/tasks/set_container_facts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
6 changes: 0 additions & 6 deletions roles/kubernetes/preinstall/tasks/0020-verify-settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 3 additions & 1 deletion tests/files/packet_centos7-crio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 3 additions & 1 deletion tests/files/packet_ubuntu18-crio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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