-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcleanup.sh
More file actions
executable file
·63 lines (53 loc) · 1.99 KB
/
cleanup.sh
File metadata and controls
executable file
·63 lines (53 loc) · 1.99 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
# Complete Cleanup Script
# This will delete everything and prepare for a fresh start
set -e
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m'
echo "=========================================="
echo "Complete Cleanup - Fresh Start"
echo "=========================================="
# 1. Delete the namespace (this removes everything inside it)
echo -e "${YELLOW}Step 1: Deleting split-app namespace...${NC}"
kubectl delete namespace split-app --ignore-not-found=true --timeout=60s || echo "Namespace already deleted or doesn't exist"
# 2. Wait for namespace to be fully deleted
echo -e "${YELLOW}Step 2: Waiting for namespace to be fully deleted...${NC}"
while kubectl get namespace split-app &> /dev/null; do
echo "Waiting for namespace to terminate..."
sleep 5
done
echo -e "${GREEN}Namespace deleted!${NC}"
# 3. Stop minikube
echo -e "${YELLOW}Step 3: Stopping Minikube...${NC}"
minikube stop || echo "Minikube already stopped"
# 4. Delete minikube cluster (optional - for complete fresh start)
echo -e "${YELLOW}Step 4: Do you want to delete the entire Minikube cluster? (y/N)${NC}"
read -r response
if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]; then
echo "Deleting Minikube cluster..."
minikube delete
echo -e "${GREEN}Minikube cluster deleted!${NC}"
else
echo "Keeping Minikube cluster"
fi
# 5. Clean up Docker images (optional)
echo -e "${YELLOW}Step 5: Do you want to remove old Docker images? (y/N)${NC}"
read -r response
if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]; then
echo "Removing old images..."
eval $(minikube docker-env) 2>/dev/null || true
docker rmi auth-service:latest 2>/dev/null || true
docker rmi split-data-service:latest 2>/dev/null || true
docker rmi split-service:latest 2>/dev/null || true
echo -e "${GREEN}Docker images cleaned!${NC}"
else
echo "Keeping Docker images"
fi
echo ""
echo -e "${GREEN}Cleanup Complete!${NC}"
echo ""
echo "Now you can run a fresh setup with:"
echo -e "${GREEN} ./setup.sh${NC}"
echo ""