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