mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-10-29 22:03:22 -02:30
Splits the definitions into two dicts, while joining then for now to preserve the downloads dict. Update all consumers of the variables, which are roughly: - manual includes of the download role (which will be removed in the short future) - install tasks using the resolved 'dest' to find the artefacts This will make further division of the downloads role easier.
34 lines
1.3 KiB
Bash
Executable File
34 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
set -eo pipefail
|
|
|
|
CURRENT_DIR=$(cd $(dirname $0); pwd)
|
|
TEMP_DIR="${CURRENT_DIR}/temp"
|
|
REPO_ROOT_DIR="${CURRENT_DIR%/contrib/offline}"
|
|
|
|
: ${DOWNLOAD_YML:="roles/kubespray_defaults/defaults/main/download.yml"}
|
|
|
|
mkdir -p ${TEMP_DIR}
|
|
|
|
# generate all download files url template
|
|
grep 'download_url:' ${REPO_ROOT_DIR}/${DOWNLOAD_YML} \
|
|
| sed 's/^.*_url: //g;s/\"//g' > ${TEMP_DIR}/files.list.template
|
|
|
|
# generate all images list template
|
|
sed -n '/^downloads_container:/,/download_defaults:/p' ${REPO_ROOT_DIR}/${DOWNLOAD_YML} \
|
|
| sed -n "s/image_name: //p" | tr -d ' ' \
|
|
| tr ' ' ':' | sed 's/\"//g' > ${TEMP_DIR}/images.list.template
|
|
|
|
# add kube-* images to images list template
|
|
# Those container images are downloaded by kubeadm, then roles/kubespray_defaults/defaults/main/download.yml
|
|
# doesn't contain those images. That is reason why here needs to put those images into the
|
|
# list separately.
|
|
KUBE_IMAGES="kube-apiserver kube-controller-manager kube-scheduler kube-proxy"
|
|
for i in $KUBE_IMAGES; do
|
|
echo "{{ kube_image_repo }}/$i:v{{ kube_version }}" >> ${TEMP_DIR}/images.list.template
|
|
done
|
|
|
|
# run ansible to expand templates
|
|
/bin/cp ${CURRENT_DIR}/generate_list.yml ${REPO_ROOT_DIR}
|
|
|
|
(cd ${REPO_ROOT_DIR} && ansible-playbook $* generate_list.yml && /bin/rm generate_list.yml) || exit 1
|