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