#!/usr/bin/env bash


name_space=uavcloud-dev

delete_all_fronted_cmii_pod(){

   all_pod_list=($(kubectl get pods  -n "$name_space" -o=jsonpath='{.items[*].metadata.name}' | tr " " "\n"))
   for pod in "${all_pod_list[@]}"; do
       if echo "$pod" | grep -q "cmii-uav-platform"; then
          echo ""
          echo "current pod is $pod"
          kubectl -n "$name_space" delete pod "$pod" --force
       fi
   done
}

delete_all_backend_cmii_pod(){
     all_pod_list=($(kubectl get pods  -n "$name_space" -o=jsonpath='{.items[*].metadata.name}' | tr " " "\n"))
     for pod in "${all_pod_list[@]}"; do
         if echo "$pod" | grep -v "platform" | grep -q "cmii"; then
            echo ""
            echo "current pod is $pod"
            kubectl -n "$name_space" delete pod "$pod" --force
         fi
     done
}

delete_all_backend_cmii_pod