Skip to content

Commit

Permalink
registry: registry.k8s.io (#461)
Browse files Browse the repository at this point in the history
  • Loading branch information
PhotonQuantum committed Feb 15, 2024
1 parent 613c039 commit 03bd84e
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 6 deletions.
5 changes: 5 additions & 0 deletions caddy/Caddyfile.siyuan
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ https://mirror.sjtu.edu.cn {
not path /git/qemu.git/*
not path /linuxliteos/*
not path /download.flutter.io/*
not path /k8s.gcr.io/*
not path /google-fonts/*
not path /CPAN/*
not path /CRAN/*
Expand Down Expand Up @@ -994,6 +995,10 @@ https://mirror.sjtu.edu.cn {
handle_path /download.flutter.io/* {
redir * https://mirrors.tuna.tsinghua.edu.cn/flutter/download.flutter.io/{uri} 302
}
redir /k8s.gcr.io /k8s.gcr.io/ 301
handle_path /k8s.gcr.io/* {
redir * https://mirrors.sjtug.sjtu.edu.cn/registry.k8s.io{uri} 302
}
redir /google-fonts /google-fonts/ 301
handle_path /google-fonts/* {
redir * https://fonts.googleapis.com{uri} 302
Expand Down
18 changes: 16 additions & 2 deletions caddy/Caddyfile.zhiyuan
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,16 @@ k8s-gcr-io.mirrors.sjtug.sjtu.edu.cn {
output stdout
format transform "{common_log}" # log in v1 style, caddyserver/transform-encoder required
}
reverse_proxy gcr-registry:80 {
redir * https://mirrors.sjtug.sjtu.edu.cn/registry.k8s.io{uri} 302
header * x-sjtug-mirror-id zhiyuan
}

registry-k8s-io.mirrors.sjtug.sjtu.edu.cn {
log {
output stdout
format transform "{common_log}" # log in v1 style, caddyserver/transform-encoder required
}
reverse_proxy k8s-registry:80 {
header_up Host {http.reverse_proxy.upstream.hostport}
}
header * x-sjtug-mirror-id zhiyuan
Expand Down Expand Up @@ -176,6 +185,7 @@ https://mirrors.sjtug.sjtu.edu.cn {
not path /git/qemu.git/*
not path /download.flutter.io/*
not path /k8s.gcr.io/*
not path /registry.k8s.io/*
not path /docker-registry/*
not path /google-fonts/*
not path /anaconda/*
Expand Down Expand Up @@ -519,7 +529,11 @@ https://mirrors.sjtug.sjtu.edu.cn {
}
redir /k8s.gcr.io /k8s.gcr.io/ 301
handle_path /k8s.gcr.io/* {
reverse_proxy gcr-registry:80 {
redir * https://mirrors.sjtug.sjtu.edu.cn/registry.k8s.io{uri} 302
}
redir /registry.k8s.io /registry.k8s.io/ 301
handle_path /registry.k8s.io/* {
reverse_proxy k8s-registry:80 {
header_up Host {http.reverse_proxy.upstream.hostport}
}
}
Expand Down
8 changes: 7 additions & 1 deletion config.zhiyuan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,14 @@ repos:
disabled: true
- type: external
name: k8s.gcr.io
proxy_to: gcr-registry:80
subdomain: k8s-gcr-io.mirrors.sjtug.sjtu.edu.cn
serve_mode: redir
target: https://mirrors.sjtug.sjtu.edu.cn/registry.k8s.io
disabled: true
- type: external
name: registry.k8s.io
subdomain: registry-k8s-io.mirrors.sjtug.sjtu.edu.cn
proxy_to: k8s-registry:80
unified: disable
serve_mode: proxy
- type: external
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.zhiyuan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ services:
memswap_limit: 1G


gcr-registry:
container_name: zhiyuan-gcr-registry
k8s-registry:
container_name: zhiyuan-k8s-registry
restart: unless-stopped
image: registry:2.8
networks:
Expand All @@ -105,7 +105,7 @@ services:
- 80
- 5001
volumes:
- "./secrets/gcr-registry.yml:/etc/docker/registry/config.yml"
- "./secrets/k8s-registry.yml:/etc/docker/registry/config.yml"
environment:
http_proxy: http://clash:8080
https_proxy: http://clash:8080
Expand Down

0 comments on commit 03bd84e

Please sign in to comment.