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