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