update
This commit is contained in:
parent
98aaf08147
commit
6de3c42693
|
@ -50,12 +50,6 @@ TODO
|
|||
|
||||
## 安装运行
|
||||
|
||||
安装 skopeo
|
||||
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
运行同步程序
|
||||
|
||||
|
@ -68,3 +62,5 @@ python scripts/sync-to-jp.py
|
|||
## 最佳实践
|
||||
* 通过 加速 安装 kubeadm
|
||||
* 通过 加速 运行 artifacthub 上的镜像
|
||||
|
||||
|
||||
|
|
|
@ -1,25 +1,44 @@
|
|||
import os
|
||||
|
||||
REPO_REPLACE_RULE = {
|
||||
REPO_REPLACE_RULE1 = {
|
||||
"k8s.gcr.io":"k8s-gcr-jp.m.daocloud.io"
|
||||
}
|
||||
|
||||
REPO_REPLACE_RULE2 = {
|
||||
"gcr.io":"gcr-jp.m.daocloud.io",
|
||||
"docker.io":"docker-jp.m.daocloud.io",
|
||||
"quay.io":"quay-jp.m.daocloud.io",
|
||||
"ghcr.io":"ghcr-jp.m.daocloud.io",
|
||||
"ghcr.io":"ghcr-jp.m.daocloud.io"
|
||||
}
|
||||
# "":"",
|
||||
|
||||
INTERNAL_NETWORK = {
|
||||
"k8s-gcr-jp.m.daocloud.io":"10.40.134.38:6001",
|
||||
"gcr-jp.m.daocloud.io":"10.40.134.38:5001",
|
||||
"docker-jp.m.daocloud.io":"10.40.134.38:7001",
|
||||
"quay-jp.m.daocloud.io":"10.40.134.38:8001",
|
||||
"ghcr-jp.m.daocloud.io":"10.40.134.38:9001"
|
||||
}
|
||||
# "k8s.gcr.io":"k8s-gcr-jp.m.daocloud.io",
|
||||
|
||||
|
||||
REGISTRY_PASSWORD = os.environ["REGISTRY_PASSWORD"]
|
||||
|
||||
|
||||
SKEPO_CMD = "docker run -it quay.io/containers/skopeo:latest"
|
||||
SKEPO_CMD = "docker run -it --rm quay.io/containers/skopeo:latest"
|
||||
# SKEPO_CMD = "skepo" # RUN without docker
|
||||
|
||||
def skepo_sync_cmd(src_img):
|
||||
src_img = src_img.strip()
|
||||
|
||||
dest_img = "/".join(src_img.split("/")[:-1])
|
||||
for k,v in REPO_REPLACE_RULE.items():
|
||||
for k,v in REPO_REPLACE_RULE1.items():
|
||||
dest_img = dest_img.replace(k,v)
|
||||
for k,v in REPO_REPLACE_RULE2.items():
|
||||
dest_img = dest_img.replace(k,v)
|
||||
for k,v in INTERNAL_NETWORK.items():
|
||||
dest_img = dest_img.replace(k,v)
|
||||
|
||||
|
||||
cmd = SKEPO_CMD + " sync --src docker --dest docker --dest-tls-verify=false --dest-creds root:%s -f oci %s %s" %(REGISTRY_PASSWORD,src_img,dest_img)
|
||||
# print(src_img)
|
||||
# print(dest_img)
|
||||
|
|
Loading…
Reference in New Issue