-
Notifications
You must be signed in to change notification settings - Fork 9
/
uninstall.sh
executable file
·48 lines (39 loc) · 1.2 KB
/
uninstall.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env bash
if [ -f "common.sh" ]; then
. common.sh
else
source <(curl -s https://raw.githubusercontent.com/accuknox/tools/main/common.sh)
fi
uninstallMysql() {
kubectl get pod -n explorer -l "app.kubernetes.io/name=mysql" | grep "mysql" >/dev/null 2>&1
[[ $? -ne 0 ]] && statusline AOK "no mysql found, skipping uninstall" && return 0
statusline WAIT "uninstalling mysql"
helm uninstall mysql --namespace explorer
statusline AOK "uninstalling mysql"
}
uninstallFeeder() {
helm uninstall feeder-service-cilium --namespace explorer
}
uninstallCilium() {
kubectl get pod -A -l k8s-app=cilium | grep "cilium" >/dev/null 2>&1
[[ $? -ne 0 ]] && statusline AOK "cilium not installed" && return 0
statusline WAIT "uninstalling cilium"
cilium uninstall
statusline AOK "uninstalled cilium"
}
uninstallSpire() {
echo "uninstalling Spire"
helm uninstall spire --namespace explorer
}
autoDetectEnvironment
#handlePrometheusAndGrafana delete
handleKnoxAutoPolicy delete
#uninstallFeeder
uninstallMysql
handleLocalStorage delete
#uninstallSpire
uninstallCilium
#handleKubearmorPrometheusClient delete
handleKubearmor delete
kubectl get ns explorer >/dev/null 2>&1
[[ $? -eq 0 ]] && kubectl delete ns explorer