78 lines
3.2 KiB
Bash
Executable File
78 lines
3.2 KiB
Bash
Executable File
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
# runmelast.sh — Pipeline infrastructure teardown
|
|
# Removes: Kargo → ArgoCD → Woodpecker (reverse install order)
|
|
# Preserves: NFS PVs, NFS data, git-server namespace (Gitea + registry),
|
|
# stonks-oracle namespace, stonks-beta, stonks-paper
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
cd "$SCRIPT_DIR"
|
|
|
|
echo "=== Pipeline Infrastructure Teardown ==="
|
|
echo ""
|
|
echo "This will remove Kargo, ArgoCD, and Woodpecker CI."
|
|
echo "Preserved: NFS PVs, NFS data, git-server (Gitea + registry), application namespaces."
|
|
echo ""
|
|
|
|
# -------------------------------------------------------
|
|
# 1. Remove Kargo resources + Helm release
|
|
# -------------------------------------------------------
|
|
echo "--- Step 1: Removing Kargo ---"
|
|
kubectl delete -f kargo/stages/live.yaml --ignore-not-found || true
|
|
kubectl delete -f kargo/stages/paper.yaml --ignore-not-found || true
|
|
kubectl delete -f kargo/stages/beta.yaml --ignore-not-found || true
|
|
kubectl delete -f kargo/market-hours-check.yaml --ignore-not-found || true
|
|
kubectl delete -f kargo/warehouse.yaml --ignore-not-found || true
|
|
kubectl delete -f kargo/project-config.yaml --ignore-not-found || true
|
|
kubectl delete -f kargo/project.yaml --ignore-not-found || true
|
|
helm uninstall kargo --namespace kargo || true
|
|
echo " ✓ Kargo removed"
|
|
echo ""
|
|
|
|
# -------------------------------------------------------
|
|
# 2. Remove ArgoCD resources + Helm release
|
|
# -------------------------------------------------------
|
|
echo "--- Step 2: Removing ArgoCD ---"
|
|
kubectl delete -f argocd/apps/stonks-live.yaml --ignore-not-found || true
|
|
kubectl delete -f argocd/apps/stonks-paper.yaml --ignore-not-found || true
|
|
kubectl delete -f argocd/apps/stonks-beta.yaml --ignore-not-found || true
|
|
kubectl delete -f argocd/repo-secret.yaml --ignore-not-found || true
|
|
helm uninstall argocd --namespace argocd || true
|
|
echo " ✓ ArgoCD removed"
|
|
echo ""
|
|
|
|
# -------------------------------------------------------
|
|
# 3. Remove Woodpecker CI
|
|
# -------------------------------------------------------
|
|
echo "--- Step 3: Removing Woodpecker CI ---"
|
|
kubectl delete -f woodpecker/agent-rbac.yaml --ignore-not-found || true
|
|
helm uninstall woodpecker --namespace woodpecker || true
|
|
echo " ✓ Woodpecker CI removed"
|
|
echo ""
|
|
|
|
# -------------------------------------------------------
|
|
# 4. Delete namespaces (pipeline infra only)
|
|
# -------------------------------------------------------
|
|
echo "--- Step 4: Deleting pipeline namespaces ---"
|
|
for ns in woodpecker argocd kargo; do
|
|
kubectl delete namespace "$ns" --ignore-not-found || true
|
|
echo " ✓ namespace/$ns deleted"
|
|
done
|
|
echo ""
|
|
|
|
# NOTE: The following are intentionally NOT deleted:
|
|
# - NFS PersistentVolumes (pipeline-argocd-pv, pipeline-kargo-pv, pipeline-woodpecker-pv)
|
|
# - NFS data at nfs://192.168.42.8:/volume1/Kubernetes/pipelines/
|
|
# - git-server namespace (Gitea + local registry)
|
|
# - stonks-oracle namespace (production workloads)
|
|
# - stonks-beta namespace (beta workloads)
|
|
# - stonks-paper namespace (paper trading workloads)
|
|
|
|
echo "=== Pipeline Infrastructure Teardown Complete ==="
|
|
echo ""
|
|
echo "Preserved:"
|
|
echo " - NFS PVs and data (survives cluster rebuild)"
|
|
echo " - git-server namespace (Gitea + registry)"
|
|
echo " - Application namespaces (stonks-oracle, stonks-beta, stonks-paper)"
|