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