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