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