@@ -33,7 +33,7 @@ function install_helm {
3333 helm repo add drycc https://charts.drycc.cc/${CHANNEL:- stable}
3434}
3535
36- function pre_system_config {
36+ function configure_os {
3737 iptables -F
3838 iptables -X
3939 iptables -F -t nat
@@ -44,8 +44,7 @@ function pre_system_config {
4444 mount bpffs -t bpf /sys/fs/bpf
4545}
4646
47- function pre_install_k3s {
48- pre_system_config
47+ function configure_mirrors {
4948 if [[ " ${INSTALL_DRYCC_MIRROR} " == " cn" ]] ; then
5049 mkdir -p /etc/rancher/k3s
5150 cat << EOF > "/etc/rancher/k3s/registries.yaml"
7271 INSTALL_K3S_MIRROR=" ${INSTALL_DRYCC_MIRROR} "
7372 export INSTALL_K3S_MIRROR
7473 k3s_install_url=" http://rancher-mirror.cnrancher.com/k3s/k3s-install.sh"
75- addons_url=" https://drycc-mirrors.oss-accelerate.aliyuncs.com/drycc/addons/releases/download/latest/index.yaml"
7674 else
7775 k3s_install_url=" https://get.k3s.io"
78- addons_url=" https://github.com/drycc/addons/releases/download/latest/index.yaml"
7976 fi
8077}
8178
8279function install_k3s_server {
83- pre_install_k3s
80+ configure_os
81+ configure_mirrors
8482 INSTALL_K3S_EXEC=" server ${INSTALL_K3S_EXEC} --flannel-backend=none --disable=traefik --disable=local-storage --disable=servicelb --cluster-cidr=10.233.0.0/16"
8583 if [[ -z " ${K3S_URL} " ]] ; then
8684 INSTALL_K3S_EXEC=" $INSTALL_K3S_EXEC --cluster-init"
@@ -89,7 +87,8 @@ function install_k3s_server {
8987}
9088
9189function install_k3s_agent {
92- pre_install_k3s
90+ configure_os
91+ configure_mirrors
9392 curl -sfL " ${k3s_install_url} " | INSTALL_K3S_EXEC=" $INSTALL_K3S_EXEC " sh -s -
9493}
9594
@@ -179,6 +178,11 @@ function install_drycc {
179178}
180179
181180function install_helmbroker {
181+ if [[ " ${INSTALL_DRYCC_MIRROR} " == " cn" ]] ; then
182+ addons_url=" https://drycc-mirrors.oss-accelerate.aliyuncs.com/drycc/addons/releases/download/latest/index.yaml"
183+ else
184+ addons_url=" https://github.com/drycc/addons/releases/download/latest/index.yaml"
185+ fi
182186 HELMBROKER_USERNAME=$( cat /proc/sys/kernel/random/uuid)
183187 HELMBROKER_PASSWORD=$( cat /proc/sys/kernel/random/uuid)
184188
220224 echo -e " \\ 033[32m---> Helmbroker password: $HELMBROKER_PASSWORD \\ 033[0m"
221225}
222226
223- function config_haproxy {
227+ function configure_haproxy {
224228 BUILDER_IP=$( kubectl get svc drycc-builder -n drycc -o=" jsonpath={.status.loadBalancer.ingress[0].ip}" )
225229 INGRESS_IP=$( kubectl get svc ingress-nginx-controller -n kube-system -o=" jsonpath={.status.loadBalancer.ingress[0].ip}" )
226230
@@ -274,12 +278,12 @@ if [[ -z "$@" ]] ; then
274278 install_longhorn
275279 install_drycc
276280 install_helmbroker
277- config_haproxy
281+ configure_haproxy
278282 echo -e " \\ 033[32m---> Installation complete, enjoy life...\\ 033[0m"
279283else
280284 for command in " $@ "
281285 do
282286 $command
283287 echo -e " \\ 033[32m---> Installation $command complete, enjoy life...\\ 033[0m"
284288 done
285- fi
289+ fi
0 commit comments