#!/bin/bash
echo "--- 安全停止 CodiMD (保留資料) ---"

# 只刪除 Deployment, Service, Ingress, Middleware
# 故意跳過 02-codimd-pvc.yaml 和 01-codimd-secrets.yaml
kubectl delete -f manifests/03-codimd-db-deployment.yaml --ignore-not-found
kubectl delete -f manifests/05-codimd-app-deployment.yaml --ignore-not-found
kubectl delete -f manifests/04-codimd-db-svc.yaml --ignore-not-found
kubectl delete -f manifests/06-codimd-app-svc.yaml --ignore-not-found
kubectl delete -f manifests/07-codimd-ingress.yaml --ignore-not-found

echo "✅ 服務已停止，Longhorn 磁碟資料安全保留。"
