Browse Source

Download once for crio (#6998)

* download run once feature for CRI-O

* fix typo

* fix test
pull/7075/head
Sergey 3 years ago
committed by GitHub
parent
commit
096bcdd078
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 30 additions and 10 deletions
  1. 4
      roles/container-engine/cri-o/defaults/main.yml
  2. 7
      roles/container-engine/cri-o/tasks/main.yaml
  3. 15
      roles/download/tasks/set_container_facts.yml
  4. 6
      roles/kubernetes/preinstall/tasks/0020-verify-settings.yml
  5. 4
      tests/files/packet_centos7-crio.yml
  6. 4
      tests/files/packet_ubuntu18-crio.yml

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

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

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

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

4
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

4
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
Loading…
Cancel
Save