From 03f148e054dc51beb51baeaa828bfd4740c3422d Mon Sep 17 00:00:00 2001 From: Choi Yongbeom <59861163+mircyb@users.noreply.github.com> Date: Wed, 5 Jan 2022 18:14:33 +0900 Subject: [PATCH] [PATCH] nerdctl insecure registry config (#8339) Backport #8339 to 2.18-release --- roles/download/defaults/main.yml | 3 +++ roles/download/tasks/prep_download.yml | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/roles/download/defaults/main.yml b/roles/download/defaults/main.yml index 738817e5a88..748dfb3c0b8 100644 --- a/roles/download/defaults/main.yml +++ b/roles/download/defaults/main.yml @@ -48,6 +48,9 @@ download_delegate: "{% if download_localhost %}localhost{% else %}{{ groups['kub # Arch of Docker images and needed packages image_arch: "{{host_architecture | default('amd64')}}" +# Nerdctl insecure flag set +nerdctl_extra_flags: '{%- if containerd_insecure_registries is defined and containerd_insecure_registries|length>0 -%}\" --insecure-registry"{%- else -%}{%- endif -%}' + # Versions kubeadm_version: "{{ kube_version }}" etcd_version: v3.5.0 diff --git a/roles/download/tasks/prep_download.yml b/roles/download/tasks/prep_download.yml index 6fc84bc08c7..342f20c8c61 100644 --- a/roles/download/tasks/prep_download.yml +++ b/roles/download/tasks/prep_download.yml @@ -16,7 +16,7 @@ - name: prep_download | Set image pull/info command for containerd set_fact: image_info_command: "{{ bin_dir }}/nerdctl -n k8s.io images --format '{% raw %}{{ '{{' }} .Repository {{ '}}' }}:{{ '{{' }} .Tag {{ '}}' }}{% endraw %}' 2>/dev/null | grep -v ^:$ | tr '\n' ','" - image_pull_command: "{{ bin_dir }}/nerdctl -n k8s.io pull --quiet" + image_pull_command: "{{ bin_dir }}/nerdctl -n k8s.io pull --quiet{{ nerdctl_extra_flags }}" when: container_manager == 'containerd' - name: prep_download | Set image pull/info command for crio @@ -34,7 +34,7 @@ - name: prep_download | Set image pull/info command for containerd on localhost set_fact: image_info_command_on_localhost: "{{ bin_dir }}/nerdctl -n k8s.io images --format '{% raw %}{{ '{{' }} .Repository {{ '}}' }}:{{ '{{' }} .Tag {{ '}}' }}{% endraw %}' 2>/dev/null | grep -v ^:$ | tr '\n' ','" - image_pull_command_on_localhost: "{{ bin_dir }}/nerdctl -n k8s.io pull --quiet" + image_pull_command_on_localhost: "{{ bin_dir }}/nerdctl -n k8s.io pull --quiet{{ nerdctl_extra_flags }}" when: container_manager_on_localhost == 'containerd' - name: prep_download | Set image pull/info command for crio on localhost