prole/_rebind_d002.sh
chrisfu 9b9d6fdc88 Rename Prole storage objects to Synology and sync deployment updates
- Rename iSCSI storage class and PV/PVC selectors/labels from prole to synology across k8s and OpenTofu manifests\n- Update CNPG/OpenBao/Garage/monitoring init flows, render helpers, and mock scripts for synology-backed storage objects\n- Integrate related UI/core/service config/version updates and add supporting regression tests for CNPG storage/image behavior\n- Keep storage reconciliation tests aligned with current CNPG affinity output

Co-authored-by: Junie <junie@jetbrains.com>
2026-03-22 21:50:02 -07:00

57 lines
1.5 KiB
Bash

#!/usr/bin/env bash
set -euo pipefail
NS=prole-db
# Release d002 PVs by deleting old prole-db-2 PVCs
kubectl delete pvc prole-db-2 prole-db-2-wal -n "$NS" --ignore-not-found
echo "Deleted prole-db-2 PVCs"
# Wait for PVs to become Available again
for pv in synology-iscsi-d002-data synology-iscsi-d002-wal; do
for i in $(seq 1 20); do
phase=$(kubectl get pv "$pv" -o jsonpath='{.status.phase}' 2>/dev/null || echo "")
if [[ "$phase" == "Available" ]]; then
echo " PV $pv is Available"
break
fi
sleep 2
done
done
# Pre-bind prole-db-4 PVCs to d002 PVs on merlin
kubectl apply -f - <<'YAML'
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: prole-db-4
namespace: prole-db
spec:
accessModes: [ReadWriteOnce]
resources:
requests:
storage: 29Gi
storageClassName: synology-iscsi
volumeName: synology-iscsi-d002-data
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: prole-db-4-wal
namespace: prole-db
spec:
accessModes: [ReadWriteOnce]
resources:
requests:
storage: 29Gi
storageClassName: synology-iscsi
volumeName: synology-iscsi-d002-wal
YAML
echo "Created prole-db-4 PVCs pre-bound to d002 (merlin)"
# Delete the stuck prole-db-4-join Job so CNPG recreates it reading the new PVCs
kubectl delete job -n "$NS" -l cnpg.io/instanceName=prole-db-4 --ignore-not-found
echo "Deleted prole-db-4-join Job — CNPG will recreate targeting merlin"
sleep 10
kubectl get pvc,pods -n "$NS" | grep -v "Completed\|initdb"