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