-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathaws-stop-all.sh
39 lines (31 loc) · 1.3 KB
/
aws-stop-all.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
#!/bin/bash
MY_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
K8S_DIR=$(builtin cd $MY_DIR/../k8s; pwd)
# Always run from the location of this script
cd $MY_DIR
# Use optional argument as the namespace for the T2-Project
if [ $# -gt 0 ]; then
NAMESPACE_MICROSERVICES=$1
NAMESPACE_MODULITH=$2
else
NAMESPACE_MICROSERVICES="default"
NAMESPACE_MODULITH="default"
fi
# Check if the current cluster is an EKS cluster
current_context=$(kubectl config current-context)
if ! [[ $current_context == *"eks"* ]]; then
echo "You are currently not connected to an EKS cluster!"
exit 1
fi
# Delete load balancers
kubectl delete -f $K8S_DIR/load-balancer/aws-loadbalancer-grafana.yaml
kubectl delete -f $K8S_DIR/load-balancer/aws-loadbalancer-uibackend.yaml -n $NAMESPACE_MICROSERVICES
kubectl delete -f $K8S_DIR/load-balancer/aws-loadbalancer-modulith-backend.yaml -n $NAMESPACE_MODULITH
# Uninstall T2-Microservices
kubectl delete -k $K8S_DIR/t2-microservices/autoscaling/ -l t2-scenario=standard -n $NAMESPACE_MICROSERVICES
$K8S_DIR/stop-microservices.sh $NAMESPACE_MICROSERVICES
# Uninstall T2-Modulith
kubectl delete -k $MY_DIR/t2-modulith/autoscaling/ -l t2-scenario=standard -n $NAMESPACE_MODULITH
$K8S_DIR/stop-modulith.sh $NAMESPACE_MODULITH
# Delete cluster
$MY_DIR/aws-stop.sh