Skip to content

Commit

Permalink
chore: bump registry mirror from *.ketches.cn to *.m.daocloud.io
Browse files Browse the repository at this point in the history
  • Loading branch information
poneding committed Jan 23, 2025
1 parent a11459f commit 0d941d0
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 32 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
DOCKER_IMAGE := ketches/registry-proxy
ALIYUN_IMAGE := registry.cn-hangzhou.aliyuncs.com/ketches/registry-proxy
VERSION := v1.2.1
VERSION := v1.3.0

.PHONY: build
build:
Expand Down
40 changes: 17 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
- `ghcr.io`
- `gcr.io`
- `k8s.gcr.io`
- `docker.cloudsmith.io`

## 快速安装

Expand All @@ -32,7 +31,7 @@ export VERSION=$(curl -s https://api.github.com/repos/ketches/registry-proxy/rel
kubectl apply -f https://raw.githubusercontent.com/ketches/registry-proxy/$VERSION/deploy/manifests.yaml

# 代理地址
kubectl apply -f https://ghproxy.ketches.cn/https://raw.githubusercontent.com/ketches/registry-proxy/$VERSION/deploy/manifests.yaml
kubectl apply -f https://ghproxy.cc/https://raw.githubusercontent.com/ketches/registry-proxy/$VERSION/deploy/manifests.yaml
```

## 配置
Expand All @@ -51,13 +50,12 @@ data:
config.yaml: |
enabled: true
proxies:
docker.io: docker.ketches.cn
registry.k8s.io: k8s.ketches.cn
quay.io: quay.ketches.cn
ghcr.io: ghcr.ketches.cn
gcr.io: gcr.ketches.cn
k8s.gcr.io: k8s-gcr.ketches.cn
docker.cloudsmith.io: cloudsmith.ketches.cn
docker.io: docker.m.daocloud.io
registry.k8s.io: k8s.m.daocloud.io
quay.io: quay.m.daocloud.io
ghcr.io: ghcr.m.daocloud.io
gcr.io: gcr.m.daocloud.io
k8s.gcr.io: k8s-gcr.m.daocloud.io
excludeNamespaces:
- kube-system
- kube-public
Expand All @@ -77,11 +75,7 @@ data:

**proxies:**

镜像代理地址,键为需要代理的镜像地址,值为代理地址,键值对形式,默认使用 [ketches/cloudflare-registry-proxy](https://github.com/ketches/cloudflare-registry-proxy) 镜像代理服务;

> Note:
>
> 可以通过向 [ketches/cloudflare-registry-proxy](https://github.com/ketches/cloudflare-registry-proxy) 项目 [提交 Issue](https://github.com/ketches/cloudflare-registry-proxy/issues/new) 来申请添加新的国外镜像代理服务
镜像代理地址,键为需要代理的镜像地址,值为代理地址,键值对形式,默认使用 [DaoCloud/public-image-mirror](https://github.com/DaoCloud/public-image-mirror) 镜像代理服务;

**excludeNamespaces:**

Expand Down Expand Up @@ -111,7 +105,7 @@ Pod 选择器,键值对形式,默认为空,支持 Pod 选择器,例如
6. 通过 `proxies` 参数判断 Pod 中的容器镜像是否需要代理,如果是,继续流程;
7. 通过 `proxies` 参数替换容器镜像地址,完成代理,Mutating Webhook 响应请求,结束流程。

![202410211328755.png](https://images.poneding.com/2024/10/202410211328755.png)
![schematic.png](./docs/images/schematic.png)

## 使用示例

Expand All @@ -121,10 +115,10 @@ Pod 选择器,键值对形式,默认为空,支持 Pod 选择器,例如
kubectl apply -f https://raw.githubusercontent.com/ketches/registry-proxy/$VERSION/examples/dockerhub-nginx.yaml
# 代理地址
kubectl apply -f https://ghproxy.ketches.cn/https://raw.githubusercontent.com/ketches/registry-proxy/$VERSION/examples/dockerhub-nginx.yaml
kubectl apply -f https://ghproxy.cc/https://raw.githubusercontent.com/ketches/registry-proxy/$VERSION/examples/dockerhub-nginx.yaml
```

示例中的 Pod 镜像为 `nginx:latest`,经过 `registry-proxy` 自动代理后,容器镜像变为 `docker.ketches.cn/library/nginx:latest`。
示例中的 Pod 镜像为 `nginx:latest`,经过 `registry-proxy` 自动代理后,容器镜像变为 `docker.m.daocloud.io/library/nginx:latest`。

验证:

Expand All @@ -142,7 +136,7 @@ export VERSION=v1.0.0
kubectl delete -f https://raw.githubusercontent.com/ketches/registry-proxy/$VERSION/deploy/manifests.yaml
# 代理地址
kubectl delete -f https://ghproxy.ketches.cn/https://raw.githubusercontent.com/ketches/registry-proxy/$VERSION/deploy/manifests.yaml
kubectl delete -f https://ghproxy.cc/https://raw.githubusercontent.com/ketches/registry-proxy/$VERSION/deploy/manifests.yaml
```

**清理示例**:
Expand All @@ -151,17 +145,17 @@ kubectl delete -f https://ghproxy.ketches.cn/https://raw.githubusercontent.com/k
kubectl delete -f https://raw.githubusercontent.com/ketches/registry-proxy/$VERSION/examples/dockerhub-nginx.yaml
# 代理地址
kubectl delete -f https://ghproxy.ketches.cn/https://raw.githubusercontent.com/ketches/registry-proxy/$VERSION/examples/dockerhub-nginx.yaml
kubectl delete -f https://ghproxy.cc/https://raw.githubusercontent.com/ketches/registry-proxy/$VERSION/examples/dockerhub-nginx.yaml
```

## 代理参考

| 镜像地址 | 代理地址 |
| --- | --- |
| nginx:latest | docker.ketches.cn/library/nginx:latest |
| ketches/registry-proxy:latest | docker.ketches.cn/ketches/registry-proxy:latest |
| registry.k8s.io/pause:3.9 | k8s.ketches.cn/pause:3.9 |
| registry.k8s.io/ingress-nginx/controller:v1.8.2 | k8s.ketches.cn/ingress-nginx/controller:v1.8.2 |
| nginx:latest | docker.m.daocloud.io/library/nginx:latest |
| ketches/registry-proxy:latest | docker.m.daocloud.io/ketches/registry-proxy:latest |
| registry.k8s.io/pause:3.9 | k8s.m.daocloud.io/pause:3.9 |
| registry.k8s.io/ingress-nginx/controller:v1.8.2 | k8s.m.daocloud.io/ingress-nginx/controller:v1.8.2 |

## ✨ Stars

Expand Down
2 changes: 1 addition & 1 deletion deploy/manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ spec:
serviceAccountName: registry-proxy
containers:
- name: registry-proxy
image: registry.cn-hangzhou.aliyuncs.com/ketches/registry-proxy:v1.2.1
image: registry.cn-hangzhou.aliyuncs.com/ketches/registry-proxy:v1.3.0
imagePullPolicy: Always
resources:
requests:
Expand Down
Binary file added docs/images/schematic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 6 additions & 7 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,12 @@ type config struct {
}

var defaultProxies = map[string]string{
"docker.io": "docker.ketches.cn",
"registry.k8s.io": "k8s.ketches.cn",
"quay.io": "quay.ketches.cn",
"ghcr.io": "ghcr.ketches.cn",
"gcr.io": "gcr.ketches.cn",
"k8s.gcr.io": "k8s-gcr.ketches.cn",
"docker.cloudsmith.io": "cloudsmith.ketches.cn",
"docker.io": "docker.m.daocloud.io",
"registry.k8s.io": "k8s.m.daocloud.io",
"quay.io": "quay.m.daocloud.io",
"ghcr.io": "ghcr.m.daocloud.io",
"gcr.io": "gcr.m.daocloud.io",
"k8s.gcr.io": "k8s-gcr.m.daocloud.io",
}

var defaultConfig = config{
Expand Down

0 comments on commit 0d941d0

Please sign in to comment.