install.sh 1.4 KB
#!/bin/bash
export PATH=/root/local/bin:$PATH
kubectl -n <replace-your-k8s-namespace> get pods | grep -q partner01
if [ "$?" == "1" ];then
	kubectl create -f /tmp/dev/partner01/partner01.yaml --record
	kubectl -n <replace-your-k8s-namespace> get svc | grep -q partner01
	if [ "$?" == "0" ];then
		echo "partner01 service install success!"
	else
		echo "partner01 service install fail!"
	fi
	kubectl -n <replace-your-k8s-namespace> get pods | grep -q partner01
	if [ "$?" == "0" ];then
		echo "partner01 deployment install success!"
	else
		echo "partner01 deployment install fail!"
	fi
else
	kubectl delete -f /tmp/dev/partner01/partner01.yaml
	kubectl -n <replace-your-k8s-namespace> get svc | grep -q partner01
	while [ "$?" == "0" ]
	do
	kubectl -n <replace-your-k8s-namespace> get svc | grep -q partner01
	done
	kubectl -n <replace-your-k8s-namespace> get pods | grep -q partner01
	while [ "$?" == "0" ]
	do
	kubectl -n <replace-your-k8s-namespace> get pods | grep -q partner01
	done
	kubectl create -f /tmp/dev/partner01/partner01.yaml --record
	kubectl -n <replace-your-k8s-namespace> get svc | grep -q partner01
	if [ "$?" == "0" ];then
		echo "partner01 service update success!"
	else
		echo "partner01 service update fail!"
	fi
	kubectl -n <replace-your-k8s-namespace> get pods | grep -q partner01
	if [ "$?" == "0" ];then
		echo "partner01 deployment update success!"
	else
		echo "partner01 deployment update fail!"
	fi
fi