Commit 69fc1210 by tingweiwang

删除harbor 推送镜像目录

1 parent 484e0011
#!/bin/bash
harbor_host=192.168.1.32:5000
echo "解压harbor到/usr/local/目录"
tar -xvzf /root/k8s/package/harbor_aly.tar.gz -C /usr/local/
cd /usr/local/harbor/ && sed -i s/harbor_host/$harbor_host/g harbor.cfg && ./prepare && ./install.sh
#!/bin/bash
#王庭威
#用于推送k8s以及业务pod所需的基础镜像,这些镜像一般更新频率很低,所以放在gitlab上做归档。需要部署直接git clone下载镜像执行脚本即可。
harbor_host=192.168.1.32:5000
harbor_passwd=admin
image_path=/root/k8s/images
for image in `ls $image_path`
do
echo "开始导入镜像到本地"
docker load -i $image_path/$image
done
echo "开始给镜像打tag"
docker tag autodl/image-proxy:v0.9.0 $harbor_host/k8s/image-proxy:v0.9.0
docker tag autodl/ubuntu-basic:16.04 $harbor_host/k8s/ubuntu-basic:16.04
docker tag coredns/coredns:1.5.0 $harbor_host/k8s/coredns:1.5.0
docker tag nvidia/k8s-device-plugin:1.10 $harbor_host/k8s/k8s-device-plugin:1.10
docker tag busybox:1.28.3 $harbor_host/k8s/busybox:1.28.3
docker tag registry.cn-hangzhou.aliyuncs.com/google-containers/pause-amd64:3.0 $harbor_host/k8s/pause-amd64:3.0
docker tag nginx:latest $harbor_host/k8s/nginx:latest
docker tag nvidia/cuda:10.0-base-ubuntu16.04 $harbor_host/k8s/cuda:10.0-base-ubuntu16.04
echo "开始推送镜像到harbor"
docker login $harbor_host -u admin -p $harbor_passwd
docker push $harbor_host/k8s/image-proxy:v0.9.0
docker push $harbor_host/k8s/ubuntu-basic:16.04
docker push $harbor_host/k8s/coredns:1.5.0
docker push $harbor_host/k8s/k8s-device-plugin:1.10
docker push $harbor_host/k8s/busybox:1.28.3
docker push $harbor_host/k8s/pause-amd64:3.0
docker push $harbor_host/k8s/nginx:latest
docker push $harbor_host/k8s/cuda:10.0-base-ubuntu16.04
#!/bin/bash
#王庭威
# pull参数用于下载更新预处理器镜像以及导出镜像为压缩包、push参数为tag镜像以及推送镜像到私有仓库
# 如果预处理不需要支持jupter,则除了operator镜像外,其他镜像文件注释。
harbor_host=192.168.1.32:5000
harbor_passwd=admin
image_path=/data/operater-images
base_url=hb.seetatech.com/k8s
image_name=(
operator:0.1.13
#operator-python:0.0.1
#dragon:0.3.0.dev20191121-cuda10.0-ubuntu16.04
#pytorch:cuda9.2-py3-v0.4.1
#pytorch:cuda10.0-py3-v1.2.0
#tensorflow:gpu-py3-v1.14.0
#tensorflow:gpu-py3-v1.5.0
#tensorflow:gpu-py3-v1.8.0
)
####################################################
pull_save() {
echo "开始下载列表镜像"
for image in ${image_name[@]}
do
docker pull $base_url/$image
done
echo "开始导出镜像"
test -d $image_path || mkdir -pv $image_path
for img in ${image_name[@]}
do
echo "开始导出$img镜像"
docker save $base_url/$img -o $image_path/$img.tar.gz
done
echo "开始压缩镜像目录.请耐心等待"
tar -cvzf $image_path/operater-images.tar.gz $image_path
}
#####################################################
tag_push() {
for image in `ls $image_path`
do
echo "开始导入镜像到本地"
docker load -i $image_path/$image
done
echo "开始给镜像打tag"
for i in ${image_name[@]}
do
echo $i
docker tag hb.seetatech.com/k8s/$i $harbor_host/k8s/$i
echo "开始仓库登录"
docker login $harbor_host -u admin -p $harbor_passwd
echo "开始推送镜像到私有部署仓库"
docker push $harbor_host/k8s/$i
done
}
#####################################################
case $1 in
push)
tag_push
;;
pull)
pull_save
;;
*)
echo "please input (pull|push)"
esac
...@@ -14,7 +14,7 @@ image_list=`cat $image_path/image_list.txt` ...@@ -14,7 +14,7 @@ image_list=`cat $image_path/image_list.txt`
image_list_ksy=`cat $image_path/image_list_ksy.txt` image_list_ksy=`cat $image_path/image_list_ksy.txt`
host_name=`hostname` host_name=`hostname`
NFS_PATH= NFS_PATH=
NFS_SERVER=
######################################################################################## ########################################################################################
#ssh-keygen -y -f id_rsa > id_rsa.pub 私钥生成公钥 #ssh-keygen -y -f id_rsa > id_rsa.pub 私钥生成公钥
#echo "判断是否允许root登陆" #echo "判断是否允许root登陆"
...@@ -454,8 +454,15 @@ echo "###################创建pv pvc#############" ...@@ -454,8 +454,15 @@ echo "###################创建pv pvc#############"
echo "########################修改pv模板#######################" && sleep 3 echo "########################修改pv模板#######################" && sleep 3
sed -i s/NFS_PATH/$NFS_PATH/g /root/k8s/autodl_kpl_base/autodl-nfs/4-pv_pvc.yaml sed -i s/NFS_PATH/$NFS_PATH/g /root/k8s/autodl_kpl_base/autodl-nfs/4-pv_pvc.yaml
sed -i s/NFS_PATH/$NFS_PATH/g /root/k8s/autodl_kpl_base/kpl-nfs/4-pv_pvc.yaml sed -i s/NFS_PATH/$NFS_PATH/g /root/k8s/autodl_kpl_base/kpl-nfs/4-pv_pvc.yaml
sed -i s/NFS_SERVER/$NFS_SERVER/g /root/k8s/autodl_kpl_base/autodl-nfs/4-pv_pvc.yaml
sed -i s/NFS_SERVER/$NFS_SERVER/g /root/k8s/autodl_kpl_base/kpl-nfs/4-pv_pvc.yaml
kubectl apply -f /root/k8s/autodl_kpl_base/autodl-nfs kubectl apply -f /root/k8s/autodl_kpl_base/autodl-nfs
kubectl apply -f /root/k8s/autodl_kpl_base/kpl-nfs kubectl apply -f /root/k8s/autodl_kpl_base/kpl-nfs
echo "###################还原pv pvc模板配置#############" && sleep 2
sed -i s/$NFS_PATH/NFS_PATH/g /root/k8s/autodl_kpl_base/autodl-nfs/4-pv_pvc.yaml
sed -i s/$NFS_PATH/NFS_PATH/g /root/k8s/autodl_kpl_base/kpl-nfs/4-pv_pvc.yaml
sed -i s/$NFS_SERVER/NFS_SERVER/g /root/k8s/autodl_kpl_base/autodl-nfs/4-pv_pvc.yaml
sed -i s/$NFS_SERVER/NFS_SERVER/g /root/k8s/autodl_kpl_base/kpl-nfs/4-pv_pvc.yaml
echo "kpl-launcher所需证书" && sleep 2 echo "kpl-launcher所需证书" && sleep 2
kubectl apply -f /root/k8s/autodl_kpl_base/kpl-ssl-configmap-autodl.yaml kubectl apply -f /root/k8s/autodl_kpl_base/kpl-ssl-configmap-autodl.yaml
kubectl apply -f /root/k8s/autodl_kpl_base/kpl-ssl-configmap.yaml kubectl apply -f /root/k8s/autodl_kpl_base/kpl-ssl-configmap.yaml
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!