#!/usr/bin/env bash # ============================================================================= # stop-app.sh — Delete all Kubernetes objects for the Task Manager # # Drops Deployments, StatefulSets, Services, Secrets, ConfigMaps, PVCs, # and the Namespace. PersistentVolumes (cluster-scoped) and the host-path # directories are also removed. # # ⚠️ WARNING: All task data stored in the PersistentVolumes will be LOST. # To pause the app without losing data, scale to 0 manually: # kubectl scale deployment --all --replicas=0 -n taskmanager # kubectl scale statefulset --all --replicas=0 -n taskmanager # ============================================================================= set -euo pipefail NS="taskmanager" echo "=============================================" echo " Stopping (dropping) Task Manager..." echo "=============================================" echo "" echo "[1/3] Deleting namespace '$NS' and all objects inside it..." kubectl delete namespace $NS --ignore-not-found=true echo "[2/3] Deleting cluster-scoped PersistentVolumes..." kubectl delete pv postgres-pv redis-pv --ignore-not-found=true echo "[3/3] Removing host-path directories..." sudo rm -rf /mnt/taskmanager 2>/dev/null || true echo "" echo "=============================================" echo " ✓ All Kubernetes objects removed." echo " Run ./prepare-app.sh then ./start-app.sh" echo " to redeploy the application." echo "============================================="