@@ -19,7 +19,9 @@ init_arch() {
1919
2020function clean_before_exit {
2121 # delay before exiting, so stdout/stderr flushes through the logging system
22- rm -rf /tmp/drycc-values.yaml /etc/rancher/k3s/registries.yaml
22+ rm -rf /tmp/drycc-values.yaml
23+ configure_registries runtime
24+ systemctl restart k3s
2325 sleep 3
2426}
2527trap clean_before_exit EXIT
@@ -50,14 +52,28 @@ function configure_os {
5052 mount bpffs -t bpf /sys/fs/bpf
5153}
5254
53- function configure_mirrors {
54- if [[ " ${INSTALL_DRYCC_MIRROR} " == " cn" ]] ; then
55- mkdir -p /etc/rancher/k3s
55+ function configure_registries {
56+ mkdir -p /etc/rancher/k3s
57+ if [[ " $1 " == " runtime" ]] ; then
58+ if [[ -f " ${REGISTRIES_FILE} " ]] ; then
59+ cat " ${REGISTRIES_FILE} " > /etc/rancher/k3s/registries.yaml
60+ elif [[ " ${INSTALL_DRYCC_MIRROR} " == " cn" ]] ; then
61+ cat << EOF > "/etc/rancher/k3s/registries.yaml"
62+ mirrors:
63+ "docker.io":
64+ endpoint:
65+ - "https://mirror.baidubce.com"
66+ - "https://docker.mirrors.ustc.edu.cn"
67+ - "https://hub-mirror.c.163.com"
68+ - "https://registry-1.docker.io"
69+ EOF
70+ fi
71+ else
5672 cat << EOF > "/etc/rancher/k3s/registries.yaml"
5773mirrors:
5874 "docker.io":
5975 endpoint:
60- - "https://docker -mirror.drycc.cc"
76+ - "https://gcr -mirror.drycc.cc"
6177 - "https://registry-1.docker.io"
6278 "quay.io":
6379 endpoint:
@@ -72,6 +88,12 @@ mirrors:
7288 - "https://k8s-mirror.drycc.cc"
7389 - "https://k8s.gcr.io"
7490EOF
91+ fi
92+ }
93+
94+ function configure_mirrors {
95+ if [[ " ${INSTALL_DRYCC_MIRROR} " == " cn" ]] ; then
96+ configure_registries
7597 INSTALL_K3S_MIRROR=" ${INSTALL_DRYCC_MIRROR} "
7698 export INSTALL_K3S_MIRROR
7799 k3s_install_url=" http://rancher-mirror.cnrancher.com/k3s/k3s-install.sh"
0 commit comments