-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathdestroy.sh
47 lines (35 loc) · 1.07 KB
/
destroy.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
#!/bin/bash
###########################################
# COMMAND LINE ARGUMENTS:
# See: https://github.com/mrasap/bash-arg-parser
# Examples:
# to destroy an app named 'flask', call:
# bash destroy.sh -n flask
while [[ "$#" -gt 0 ]]; do case $1 in
-n|--name) NAME="$2"; shift;;
*) echo "Error, unknown parameter passed: $1."; exit 1;;
esac; shift; done
# Check to see if the name has been given
if [[ -z ${NAME} ]] || [[ ${NAME} =~ ^-.* ]];
then echo "Error, --name is not given. Aborting.."; exit 1;
fi
echo "Destroying app with name $NAME"
helm delete --purge cert-manager
helm delete --purge nginx-ingress
helm delete --purge ${NAME}
kubectl delete clusterissuers letsencrypt-prod
kubectl delete secrets powdermaps
kubectl get customresourcedefinitions | tr ' *' '\n' | grep certmanager | xargs kubectl delete customresourcedefinitions
kubectl delete namespaces cert-manager
echo "
######################
Checking helm deployments
######################
"
helm ls --all
echo "
######################
Checking kubernetes resources
######################
"
kubectl get all