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