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