#!/bin/bash


export nameSpace="uavcloud-demo"
kubectl -n ${nameSpace} delete configmap nginx-cm default-nginx-cm


## 删除所有的deployment和service
export nameSpace="uavcloud-demo"


for kindof in deployments service
do
  # kubectl -n ${nameSpace} get $kindof | grep "cmii" | grep -v "hyperspectral" | grep -v "rtsp" | grep -v "mysql"| grep -v "cms" | grep -v "minio" | awk '{print$1}'
  kubectl -n ${nameSpace} delete $kindof $(kubectl -n ${nameSpace} get $kindof | grep "cmii" | grep -v "hyperspectral" |  grep -v "rtsp" | grep -v "mysql" | grep -v "cms" | grep -v "minio" | awk '{print$1}')
done

##
for kindof in configmap
do
  kubectl -n ${nameSpace} delete $kindof $(kubectl -n ${nameSpace} get $kindof | grep "tenant" | grep -v "cms" | grep -v "minio"|  grep -v "srs" |  grep -v "vms"|  grep -v "yj" | awk '{print$1}')
done


for kindof in  ingress
do
  kubectl -n ${nameSpace} delete $kindof $(kubectl -n ${nameSpace} get $kindof | grep -v "cms" | grep -v "minio"|  grep -v "srs" |  grep -v "vms"|  grep -v "yj" | awk '{print$1}')
done


kubectl -n ${nameSpace} delete pvc