#!/bin/bash


wget https://oss.demo.uavcmlc.com/cmlc-installation/tmp/jq-linux-amd64 -O /usr/local/bin/jq
#wget https://oss.demo.uavcmlc.com/cmlc-installation/downloadfile/aarch/jq-linux-arm64 -O /usr/local/bin/jq
chmod +x /usr/local/bin/jq




export name_space_list=(bj-sh-uas-260511)

export name_space_list=(kube-system kubernetes-dashboard ingress-nginx xayd)

for name_space in ${name_space_list[*]};do

  kubectl delete pods -n $name_space --field-selector status.phase!=Running --force

  kubectl get pods -n $name_space -o json | jq -r '.items[] | select(.status.containerStatuses[0].ready == false) | .metadata.name' | xargs -r kubectl delete pod -n $name_space --force

done

kubectl -n ${name_space} delete pod  helm-nacos-0 --force
 

kubectl -n ${name_space} logs helm-nacos-0 