作者 Administrator

更新 install.sh

#!/bin/bash
export PATH=/root/local/bin:$PATH
kubectl -n mmm-suplus-prd get pods | grep -q mmm-open-api
kubectl -n mmm-suplus-prd get pods | grep -q yishujia-open-api
if [ "$?" == "1" ];then
kubectl create -f /tmp/prd/mmm-open-api/mmm-open-api.yaml --record
kubectl -n mmm-suplus-prd get svc | grep -q mmm-open-api
kubectl create -f /tmp/prd/yishujia-open-api/yishujia-open-api.yaml --record
kubectl -n mmm-suplus-prd get svc | grep -q yishujia-open-api
if [ "$?" == "0" ];then
echo "mmm-open-api service install success!"
echo "yishujia-open-api service install success!"
else
echo "mmm-open-api service install fail!"
echo "yishujia-open-api service install fail!"
fi
kubectl -n mmm-suplus-prd get pods | grep -q mmm-open-api
kubectl -n mmm-suplus-prd get pods | grep -q yishujia-open-api
if [ "$?" == "0" ];then
echo "mmm-open-api deployment install success!"
echo "yishujia-open-api deployment install success!"
else
echo "mmm-open-api deployment install fail!"
echo "yishujia-open-api deployment install fail!"
fi
else
kubectl delete -f /tmp/prd/mmm-open-api/mmm-open-api.yaml
kubectl -n mmm-suplus-prd get svc | grep -q mmm-open-api
kubectl delete -f /tmp/prd/yishujia-open-api/yishujia-open-api.yaml
kubectl -n mmm-suplus-prd get svc | grep -q yishujia-open-api
while [ "$?" == "0" ]
do
kubectl -n mmm-suplus-prd get svc | grep -q mmm-open-api
kubectl -n mmm-suplus-prd get svc | grep -q yishujia-open-api
done
kubectl -n mmm-suplus-prd get pods | grep -q mmm-open-api
kubectl -n mmm-suplus-prd get pods | grep -q yishujia-open-api
while [ "$?" == "0" ]
do
kubectl -n mmm-suplus-prd get pods | grep -q mmm-open-api
kubectl -n mmm-suplus-prd get pods | grep -q yishujia-open-api
done
kubectl create -f /tmp/prd/mmm-open-api/mmm-open-api.yaml --record
kubectl -n mmm-suplus-prd get svc | grep -q mmm-open-api
kubectl create -f /tmp/prd/yishujia-open-api/yishujia-open-api.yaml --record
kubectl -n mmm-suplus-prd get svc | grep -q yishujia-open-api
if [ "$?" == "0" ];then
echo "mmm-open-api service update success!"
echo "yishujia-open-api service update success!"
else
echo "mmm-open-api service update fail!"
echo "yishujia-open-api service update fail!"
fi
kubectl -n mmm-suplus-prd get pods | grep -q mmm-open-api
kubectl -n mmm-suplus-prd get pods | grep -q yishujia-open-api
if [ "$?" == "0" ];then
echo "mmm-open-api deployment update success!"
echo "yishujia-open-api deployment update success!"
else
echo "mmm-open-api deployment update fail!"
echo "yishujia-open-api deployment update fail!"
fi
fi
\ No newline at end of file
... ...