mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-03-10 04:08:02 +03:00
Enable delegating all downloads (binaries, images, kubeadm images) (#4420)
* Download to delegate and sync files when download_run_once * Fail on error after saving container image * Do not set changed status when downloaded container was up to date * Only sync containers when they are actually required Previously, non-required images (pull_required=false as image existed on target host) were synced to the target hosts. This failed as the image was not downloaded to the download_delegate and hence was not available for syncing. * Sync containers when only missing on some hosts * Consider images with multiple repo tags * Enable kubeadm images pull/syncing with download_delegate * Use kubeadm images list to pull/sync 'kubeadm config images pull' is replaced by collecting the images list with 'kubeadm config images list' and using the commonly used method of pull/syncing the images. * Ensure containers are downloaded and synced for all hosts * Fix download/syncing when download_delegate is a kubernetes host
This commit is contained in:
committed by
Kubernetes Prow Robot
parent
e814da1eec
commit
d6fd0d2aca
@@ -1,4 +1,22 @@
|
||||
---
|
||||
- name: kubeadm | Download kubeadm
|
||||
include_tasks: "download_file.yml"
|
||||
vars:
|
||||
download: "{{ download_defaults | combine(downloads.kubeadm) }}"
|
||||
when:
|
||||
- not skip_downloads|default(false)
|
||||
- downloads.kubeadm.enabled
|
||||
|
||||
- name: kubeadm | Sync kubeadm
|
||||
include_tasks: "sync_file.yml"
|
||||
vars:
|
||||
download: "{{ download_defaults | combine(downloads.kubeadm) }}"
|
||||
when:
|
||||
- not skip_downloads|default(false)
|
||||
- downloads.kubeadm.enabled
|
||||
- download_run_once
|
||||
- group_names | intersect(download.groups) | length
|
||||
|
||||
- name: kubeadm | Create kubeadm config
|
||||
template:
|
||||
src: "kubeadm-images.yaml.j2"
|
||||
@@ -6,7 +24,7 @@
|
||||
|
||||
- name: kubeadm | Copy kubeadm binary from download dir
|
||||
synchronize:
|
||||
src: "{{ local_release_dir }}/kubeadm"
|
||||
src: "{{ local_release_dir }}/kubeadm-{{ kubeadm_version }}-{{ image_arch }}"
|
||||
dest: "{{ bin_dir }}/kubeadm"
|
||||
compress: no
|
||||
perms: yes
|
||||
@@ -22,3 +40,33 @@
|
||||
|
||||
- name: container_download | download images for kubeadm config images
|
||||
command: "{{ bin_dir }}/kubeadm config images pull --config={{ kube_config_dir }}/kubeadm-images.yaml"
|
||||
when: not download_run_once
|
||||
|
||||
- name: container_download | fetch list of kubeadm config images
|
||||
command: "{{ bin_dir }}/kubeadm config images list --config={{ kube_config_dir }}/kubeadm-images.yaml"
|
||||
register: result
|
||||
run_once: true
|
||||
when: download_run_once
|
||||
changed_when: false
|
||||
|
||||
- vars:
|
||||
kubeadm_images_list: "{{ result.stdout_lines }}"
|
||||
set_fact:
|
||||
kubeadm_image:
|
||||
key: "kubeadm_{{ (item | regex_replace('^(?:.*\\/)*','')).split(':')[0] }}"
|
||||
value:
|
||||
enabled: true
|
||||
container: true
|
||||
repo: "{{ item.split(':')[0] }}"
|
||||
tag: "{{ item.split(':')[1] }}"
|
||||
groups:
|
||||
- k8s-cluster
|
||||
loop: "{{ kubeadm_images_list | flatten(levels=1) }}"
|
||||
run_once: true
|
||||
when: download_run_once
|
||||
register: result_images
|
||||
|
||||
- set_fact:
|
||||
kubeadm_images: "{{ result_images.results | map(attribute='ansible_facts.kubeadm_image') | list | items2dict }}"
|
||||
run_once: true
|
||||
when: download_run_once
|
||||
|
||||
Reference in New Issue
Block a user