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