MetaTrader5-Docker-Goldex/destroy-tf-force.sh.k3s
bast 3f649fca21
Some checks failed
MT5 Stack Deploy / deploy (push) Failing after 4s
Deploy per Terraform/SSH
2026-11-07 06:31:49 +01:00

35 lines
1.4 KiB
Bash
Executable file
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# Räumt den MT5-Helm-Release hart aus dem K3s-Cluster.
#
# ./destroy-tf-force.sh -> alles weg, PVC (Wine-Prefix, MT5-Login, History) bleibt
# ./destroy-tf-force.sh --with-data -> zusätzlich PVC löschen (MT5 installiert sich neu)
set -u
RELEASE="mt5"
NAMESPACE="trading"
K="docker exec local-k3s-platform kubectl"
RESOURCES="ingress,service,deployment,statefulset,replicaset,pod,configmap,secret"
if [ "${1:-}" = "--with-data" ]; then
RESOURCES="${RESOURCES},pvc"
echo "!!! --with-data: PVC ${RELEASE}-config wird mitgelöscht"
fi
echo "1. Entferne alle physischen K3s-Ressourcen von '${RELEASE}' in '${NAMESPACE}'..."
$K delete ${RESOURCES} -l app.kubernetes.io/instance=${RELEASE} -n ${NAMESPACE} \
--ignore-not-found=true --force --grace-period=0
echo "2. Lösche das geheime Helm-Release-Protokoll aus der K3s-Datenbank..."
# Helm speichert Releases als Secrets mit dem Typ 'sh.helm.release.v1...'
$K delete secret -n ${NAMESPACE} -l owner=helm,name=${RELEASE} \
--ignore-not-found=true --force --grace-period=0
echo "3. Atempause für die Cluster-API..."
sleep 2
echo "4. Kontrolle – hier sollte nichts mehr von '${RELEASE}' stehen:"
$K get all,ingress,secret,pvc -n ${NAMESPACE} -l app.kubernetes.io/instance=${RELEASE} 2>/dev/null
$K get secret -n ${NAMESPACE} -l owner=helm,name=${RELEASE} 2>/dev/null
echo "Cluster ist absolut jungfräulich sauber!"