Skip to content

Commit

Permalink
Merge pull request #1007 from tu1h/kubespray_download_files_compat
Browse files Browse the repository at this point in the history
make kubespray download files compatible
  • Loading branch information
ErikJiang authored Nov 16, 2023
2 parents f12d640 + 97e1cea commit 2b3df87
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions artifacts/manage_version_cr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ function extract_etcd_version() {
IFS='.'
read -ra arr <<<"${kube_version}"
major="${arr[0]}.${arr[1]}"
version=$(yq ".etcd_supported_versions.\"${major}\"" kubespray/roles/download/defaults/main/main.yml)
version=$(yq ".etcd_supported_versions.\"${major}\"" kubespray/roles/download/defaults/main.yml)
echo "${version}"
}

function extract_version() {
local version_name="${1}" ## cni_version
local dir="${2}" ## kubespray-defaults or download
local version
version=$(yq ".${version_name}" kubespray/roles/download/defaults/main/main.yml)
version=$(yq ".${version_name}" kubespray/roles/download/defaults/main.yml)
if [[ -n "${dir}" ]]; then
version=$(yq ".${version_name}" kubespray/roles/"${dir}"/defaults/main.*ml)
fi
Expand All @@ -63,7 +63,7 @@ function extract_version() {
function extract_version_range() {
local range_path="${1}" ## .cni_binary_checksums.amd64
local version
version=$(yq "${range_path} | keys" kubespray/roles/download/defaults/main/checksums.yml --output-format json)
version=$(yq "${range_path} | keys" kubespray/roles/download/defaults/main.yml --output-format json)
version=$(echo "${version}" | tr -d '\n \r') ## ["v1","v2"]
echo "${version}"
}
Expand Down Expand Up @@ -215,14 +215,22 @@ function create_info_manifest_cr() {
update_docker_component_version "ubuntu" "${docker_version_default}" "${docker_version_range_ubuntu}"
}

function merge_kubespray_offline_download_files() {
if [ -d 'kubespray/roles/download/defaults/main' ]; then
cat kubespray/roles/download/defaults/main/* | sed '/^---$/d' > kubespray/roles/download/defaults/main.yml
fi
}

case $OPTION in
create_localartifactset)
check_dependencies
merge_kubespray_offline_download_files
create_offline_version_cr
;;

create_manifest)
check_dependencies
merge_kubespray_offline_download_files
create_info_manifest_cr
;;

Expand Down

0 comments on commit 2b3df87

Please sign in to comment.