-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstaller.sh
executable file
·88 lines (78 loc) · 2.45 KB
/
installer.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/usr/bin/env bash
source "scripts/log.sh"
actions=("download" "push" "all" "install")
image_base_url="http://kubeblocks-oss.oss-cn-zhangjiakou.aliyuncs.com/images"
chart_base_url="http://kubeblocks-oss.oss-cn-zhangjiakou.aliyuncs.com/charts"
tools_base_url="http://kubeblocks-oss.oss-cn-zhangjiakou.aliyuncs.com/tools"
yq_name="yq_linux_amd64"
skopeo_name="skopeo_linux_amd64"
manifests_file="manifests/manifests.yaml"
values_file="manifests/values.yaml"
if [ "$#" -eq 0 ]; then
warn "Usage: $0 <action>"
warn "Available actions: ${actions[*]}"
exit 1
else
action=$1
fi
function get_cloud_version() {
yq eval '.kubeblocks-cloud[0].version' manifests/manifests.yaml
}
function prepare_bins() {
mkdir -p bin
wget -nc -P bin ${tools_base_url}/yq/${yq_name}.tar.gz
wget -nc -P bin ${tools_base_url}/skopeo/${skopeo_name}.tar.gz
}
function prepare_sealos() {
wget -nc https://kubeblocks-oss.oss-cn-zhangjiakou.aliyuncs.com/artifact/kube-airgap-sealos-v5.0.0.tar.gz
}
function prepare_registry() {
mkdir -p registry
cloud_version=$(get_cloud_version)
wget -nc -P registry "${image_base_url}/kubeblocks-enterprise-${cloud_version}.tar.gz"
chart_names=$(yq e "to_entries|map(.key)|.[]" ${manifests_file})
for chart_name in $chart_names; do
chart_enable=$(yq e ".${chart_name}.enable" ${values_file})
if [[ "${chart_enable}" == "false" ]]; then
echo "$(tput -T xterm setaf 3)skip download ${chart_name} images$(tput -T xterm sgr0)"
continue
fi
chart_version=$(yq e ".${chart_name}[0].version" ${manifests_file})
wget -nc -P registry "${image_base_url}/${chart_name}-${chart_version}.tar.gz"
done
}
function prepare_charts() {
cloud_version=$(get_cloud_version)
wget -nc "${chart_base_url}/kubeblocks-enterprise-charts-${cloud_version}.tgz.gz"
}
# prepare the airgap package, download the required files
function prepare_airgap() {
prepare_bins
prepare_sealos
prepare_registry
prepare_charts
}
function main() {
check_supported_engines
case $action in
airgap)
prepare_airgap
;;
push)
check_images_exist
prepare_deployment
push_images
;;
install)
install
;;
all)
download_images
prepare_deployment
push_images
install
;;
esac
version_list
}
main "$@"