-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
71 lines (61 loc) · 1.61 KB
/
install.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
#!/usr/bin/env bash
source /etc/kubeworkz/manifests/utils.sh
source /etc/kubeworkz/manifests/install.conf
system_info
# params_process do params check of install.conf
function params_process() {
# check NODE_MODE
if [ -z ${NODE_MODE} ]
then
clog error "NODE_MODE cannot be empty!"
exit 1
else
NODE_MODE_LEGAL="false"
for v in "control-plane-master" "master" "node-join-control-plane" "node-join-master"
do
if [ ${NODE_MODE} = $v ];then
NODE_MODE_LEGAL="true"
break
fi
done
if [ ${NODE_MODE_LEGAL} = "false" ]; then
clog error "NODE_MODE illegal! must be one of:control-plane-master,master,node-join-control-plane,node-join-master"
exit 1
fi
fi
# check CNI
if [ -z ${CNI} ]; then
clog error "CNI can not be empty"
exit 1
fi
# check MASTER_IP
if [ -z ${MASTER_IP} ]; then
if [ ${NODE_MODE} = "master" ]; then
MASTER_IP=$(hostname -I |awk '{print $1}')
else
clog error "MASTER_IP can not be empty!"
exit 1
fi
fi
if [ ! -z ${KUBERNETES_BIND_ADDRESS} ]; then
IPADDR=${KUBERNETES_BIND_ADDRESS}
fi
}
params_process
# install k8s or not
if [[ ${INSTALL_KUBERNETES} = "true" ]]; then
/bin/bash /etc/kubeworkz/manifests/install_k8s.sh
if [ "$?" -ne 0 ]; then
clog error "install kubernetes failed"
exit 1
fi
if [[ ${PRE_DOWNLOAD} = "true" ]]; then
clog info "offline manifests download success"
exit 0
fi
fi
if [[ ${INSTALL_KUBEWORKZ_PIVOT} = "true" ]]; then
# download helm to install kubeworkz helm chart
helm_download
/bin/bash /etc/kubeworkz/manifests/install_kubeworkz.sh
fi