-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquick-cleanup.sh
More file actions
executable file
·35 lines (29 loc) · 1.27 KB
/
quick-cleanup.sh
File metadata and controls
executable file
·35 lines (29 loc) · 1.27 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
#!/bin/bash
# Quick cleanup for development iterations - K8s workloads only
set -e
echo "🧹 Quick cleanup: Kubernetes workloads only..."
echo "💡 This keeps infrastructure running, only cleans applications"
# Configure kubectl if needed
cd infra-dev
if [ -f terraform.tfstate ]; then
CLUSTER_NAME=$(terraform output -raw cluster_name 2>/dev/null || echo "")
if [ -n "$CLUSTER_NAME" ]; then
aws eks update-kubeconfig --region us-west-2 --name $CLUSTER_NAME
fi
fi
cd ..
# Quick K8s cleanup
if kubectl cluster-info &> /dev/null; then
echo "🗑️ Deleting Kubernetes applications..."
# Delete in order to avoid hanging resources
kubectl delete ingress --all -n monopoly-game --ignore-not-found=true --timeout=60s
kubectl delete deployment --all -n monopoly-game --ignore-not-found=true --timeout=60s
kubectl delete svc --all -n monopoly-game --ignore-not-found=true --timeout=60s
kubectl delete pvc --all -n monopoly-game --ignore-not-found=true --timeout=60s
kubectl delete secret --all -n monopoly-game --ignore-not-found=true
echo "✅ Applications cleaned up"
echo "🏗️ Infrastructure remains running"
echo "🚀 Ready for redeployment with: ./deploy-k8s.sh"
else
echo "❌ Could not connect to cluster"
fi