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