0
有沒有辦法刪除以前的部署使用CLI?刪除部署/複製控制器openshift cli來
當我成功運行oc import-image $APPLICATION
新的部署出現了RC和幾個運行後我打的RC max和將不得不手動刪除以前的部署。
是否有類似oc delete rc $APPLICATION-$(($DEPLOYMENT_NUMBER - 1))
腳本?
有沒有辦法刪除以前的部署使用CLI?刪除部署/複製控制器openshift cli來
當我成功運行oc import-image $APPLICATION
新的部署出現了RC和幾個運行後我打的RC max和將不得不手動刪除以前的部署。
是否有類似oc delete rc $APPLICATION-$(($DEPLOYMENT_NUMBER - 1))
腳本?
我結束了使用下面的代碼來創建一個(衝)解決方案。
# DEPLOYMENT_COUNT will be the number of deployments
DEPLOYMENT_COUNT=`oc get rc | wc -l`
DEPLOYMENT_COUNT=$((DEPLOYMENT_COUNT - 1))
for ((i=1; i<$DEPLOYMENT_COUNT + 1; i++))
do
#CURR_POD_LINE=`oc get rc | tail -$i | head -n1`
DEPLOYMENT_ID=`oc get rc | tail -$i | head -n1 | awk '{print $1}'`
DESIRED_PODS_COUNT=`oc get rc | tail -$i | head -n1 | awk '{print $5}'`
# IF number of desired pods is 0, then delete the deployment
if [ $DESIRED_PODS_COUNT -eq 0 ]
then
#DELETE
oc delete rc $DEPLOYMENT_ID
fi
echo $DEPLOYMENT_ID
echo $DESIRED_PODS_COUNT
done