Update KubeSphere delete scripts, fix issue delete other namespace
Created by: tanrobotix
The issue is if there is another namespace that its name is the word in dict. It will be catch by grep
then execute.
For instance: if there is a monitoring
namespace (create by prometheus-operator):
++ for namespace in '`kubectl get namespaces|awk '\''{print $1}'\''|grep -v NAME`'
+++ echo kubesphere-system openpitrix-system kubesphere-monitoring-system kubesphere-alerting-system kubesphere-controls-system
+++ grep monitoring
++ result='kubesphere-system openpitrix-system kubesphere-monitoring-system kubesphere-alerting-system kubesphere-controls-system'
++ [[ kubesphere-system openpitrix-system kubesphere-monitoring-system kubesphere-alerting-system kubesphere-controls-system != '' ]]
++ echo 'kubectl delete all --all -n monitoring'
kubectl delete all --all -n monitoring
I had edit the script, provide some bash pipeline. You can take look. Thank you