mirror of https://github.com/easzlab/kubeasz.git
add tool: trans_yml.sh
parent
e2fdd779ec
commit
18133ee301
|
@ -17,9 +17,7 @@
|
|||
- docker 18.03.0-ce
|
||||
- calico v3.0.6
|
||||
- flannel v0.10.0
|
||||
|
||||
**注1:** 集群用到的所有二进制文件已打包好供下载 [https://pan.baidu.com/s/1c4RFaA](https://pan.baidu.com/s/1c4RFaA)
|
||||
|
||||
**注2:** 为提高集群网络插件安装的灵活性,使用`DaemonSet Pod`方式运行网络插件,目前支持`Calico` `flannel`可选
|
||||
|
||||
## 快速指南
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
#!/bin/bash
|
||||
|
||||
# 不同k8s版本使用的'api-versions'版本不同,此脚本用于切换yaml文件使用的'api-versions'
|
||||
|
||||
#set -x
|
||||
|
||||
show_usage()
|
||||
{
|
||||
echo -e "\nUsage: $0 <-v K8S_VER> <-f YAML_FILE>"
|
||||
echo -e "\nK8S_VER: support 1.8/1.9/1.10"
|
||||
}
|
||||
|
||||
#check_arg -------------------------------------------------
|
||||
K8S_VER=""
|
||||
YML_FILE=""
|
||||
|
||||
while getopts "v:f:" arg
|
||||
do
|
||||
case $arg in
|
||||
v)
|
||||
K8S_VER=$OPTARG
|
||||
;;
|
||||
f)
|
||||
if [ -w "$OPTARG" ];then
|
||||
YML_FILE=$OPTARG
|
||||
else
|
||||
echo File:"$OPTARG not found or not writeable."
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
?)
|
||||
echo -e "unkown argument"
|
||||
show_usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "$K8S_VER" = "" ] || [ "$YML_FILE" = "" ];then
|
||||
echo "error argument"
|
||||
show_usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
main()
|
||||
{
|
||||
case "$K8S_VER" in
|
||||
1.8)
|
||||
sed -i 's/apps\/v1/extensions\/v1beta1/g' $YML_FILE
|
||||
exit 0
|
||||
;;
|
||||
1.9)
|
||||
echo "K8s_VER is $K8S_VER"
|
||||
exit 0
|
||||
;;
|
||||
1.10)
|
||||
sed -i 's/extensions\/v1beta1/apps\/v1/g' $YML_FILE
|
||||
exit 0
|
||||
;;
|
||||
?)
|
||||
;;
|
||||
esac
|
||||
echo "not supported K8s_VER:$K8S_VER"
|
||||
exit 1
|
||||
}
|
||||
|
||||
main
|
Loading…
Reference in New Issue