Skip to content

Commit 51b2731

Browse files
committed
chore(workflow): add stable mirror
1 parent de5d801 commit 51b2731

2 files changed

Lines changed: 28 additions & 5 deletions

File tree

_scripts/install.sh

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ init_arch() {
1919

2020
function 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
}
2527
trap 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"
5773
mirrors:
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"
7490
EOF
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"

src/quickstart/install-workflow.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ DRYCC_ADMIN_USERNAME | Required item, specify drycc's admi
195195
DRYCC_ADMIN_PASSWORD | Required item, specify drycc's admin password
196196
CERT_MANAGER_ENABLED | Whether to use automatic certificate. It is `true` by default
197197
CHANNEL | By default, `stable` channel will be installed. You can also specify `testing`
198+
REGISTRIES_FILE | The `registers.yaml` file used by k3s.
198199
USE_HAPROXY | Haproxy is enabled by default. If you want to turn it off, this value is false
199200
METALLB_ADDRESS_POOLS | IP pool for LoadBalancer. The default is `172.16.0.0/12`
200201
INSTALL_DRYCC_MIRROR | Specify the accelerated mirror location. Currently, only `cn` is supported

0 commit comments

Comments
 (0)