feat(k01): add teardown script for clean reset of data and service layers
build-and-push-harbor / docker-build-push (push) Waiting to run
build-and-push-harbor / docker-build-push (push) Waiting to run
This commit is contained in:
@@ -25,7 +25,7 @@ bash apply-infra.sh # 数据层 + envoy + ratelimit,分批等待 Ready
|
|||||||
bash apply-schema.sh # 向 CNPG 写入 schema 与 fixture
|
bash apply-schema.sh # 向 CNPG 写入 schema 与 fixture
|
||||||
bash apply-services.sh # 启动业务 Deployment
|
bash apply-services.sh # 启动业务 Deployment
|
||||||
|
|
||||||
kubectl -n juwan get pods -w
|
# 可以用 `bash teardown.sh` 来卸载数据层和业务层
|
||||||
```
|
```
|
||||||
|
|
||||||
## 做什么
|
## 做什么
|
||||||
|
|||||||
Executable
+35
@@ -0,0 +1,35 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
K01_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||||
|
export KUBECONFIG="${KUBECONFIG:-/etc/rancher/k3s/k3s.yaml}"
|
||||||
|
|
||||||
|
echo services
|
||||||
|
for f in "${K01_DIR}/services/"*.yaml; do
|
||||||
|
kubectl delete -f "$f" --ignore-not-found --wait=false
|
||||||
|
done
|
||||||
|
|
||||||
|
echo data crs
|
||||||
|
kubectl -n juwan delete cluster.postgresql.cnpg.io --all --wait=false 2>/dev/null || true
|
||||||
|
kubectl -n juwan delete redisreplication --all --wait=false 2>/dev/null || true
|
||||||
|
kubectl -n juwan delete redissentinel --all --wait=false 2>/dev/null || true
|
||||||
|
kubectl -n juwan delete mongodbcommunity --all --wait=false 2>/dev/null || true
|
||||||
|
kubectl -n kafka delete kafkatopic --all --wait=false 2>/dev/null || true
|
||||||
|
kubectl -n kafka delete kafka --all --wait=false 2>/dev/null || true
|
||||||
|
kubectl -n kafka delete kafkanodepool --all --wait=false 2>/dev/null || true
|
||||||
|
|
||||||
|
echo network
|
||||||
|
kubectl delete -f "${K01_DIR}/infra/envoy.yaml" --ignore-not-found --wait=false
|
||||||
|
kubectl delete -f "${K01_DIR}/infra/ratelimit.yaml" --ignore-not-found --wait=false
|
||||||
|
|
||||||
|
sleep 30
|
||||||
|
|
||||||
|
echo cleanup orphaned
|
||||||
|
kubectl -n juwan delete pod --all --force --grace-period=0 2>/dev/null || true
|
||||||
|
kubectl -n juwan delete pvc --all --wait=false 2>/dev/null || true
|
||||||
|
kubectl -n kafka delete pod --all --force --grace-period=0 2>/dev/null || true
|
||||||
|
kubectl -n kafka delete pvc --all --wait=false 2>/dev/null || true
|
||||||
|
|
||||||
|
kubectl get pods,pvc -n juwan
|
||||||
|
kubectl get pods,pvc -n kafka
|
||||||
|
kubectl describe node | grep -A 6 Allocated
|
||||||
Reference in New Issue
Block a user