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