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