Files
cloud-host/backend/helm/cloudhost-ceph/scripts/wait-ceph-ready.sh
T
keyhan ee5bd0a291 Add Harbor/Ceph runbooks and align single-node Ceph docs with abr deployment.
Document registry ingress split, image mirroring, loop OSD setup, and platform integration paths.
2026-07-01 00:22:06 +03:30

40 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# Wait until Ceph reports HEALTH_OK or HEALTH_WARN (single-node often stays WARN).
set -euo pipefail
TIMEOUT="${1:-900}"
ROOK_NS="rook-ceph"
START=$(date +%s)
echo "Waiting for rook-ceph-tools deployment..."
for _ in $(seq 1 60); do
if kubectl -n "${ROOK_NS}" get deploy rook-ceph-tools >/dev/null 2>&1; then
if kubectl -n "${ROOK_NS}" rollout status deploy/rook-ceph-tools --timeout=120s 2>/dev/null; then
break
fi
fi
sleep 5
done
while true; do
NOW=$(date +%s)
if (( NOW - START > TIMEOUT )); then
echo "Timed out after ${TIMEOUT}s waiting for Ceph health" >&2
kubectl -n "${ROOK_NS}" get cephcluster,pod -o wide || true
exit 1
fi
if kubectl -n "${ROOK_NS}" get deploy rook-ceph-tools >/dev/null 2>&1; then
HEALTH=$(kubectl -n "${ROOK_NS}" exec deploy/rook-ceph-tools -- ceph health 2>/dev/null || echo "unknown")
echo "Ceph health: ${HEALTH}"
if [[ "${HEALTH}" == "HEALTH_OK" || "${HEALTH}" == HEALTH_WARN* ]]; then
PHASE=$(kubectl -n "${ROOK_NS}" get cephcluster rook-ceph -o jsonpath='{.status.phase}' 2>/dev/null || echo "")
echo "CephCluster phase: ${PHASE}"
if [[ "${PHASE}" == "Ready" ]]; then
exit 0
fi
fi
fi
sleep 15
done