diff --git a/deployment.yaml b/deployment.yaml index e5e671c..7aea18e 100644 --- a/deployment.yaml +++ b/deployment.yaml @@ -64,6 +64,13 @@ spec: - name: vol mountPath: /home/agent/vol + readinessProbe: + exec: + command: ["test", "!", "-f", "/home/agent/vol/.openclaw-initializing"] + initialDelaySeconds: 5 + periodSeconds: 5 + failureThreshold: 60 + env: # ── Required ──────────────────────────────────────────── diff --git a/entrypoint.sh b/entrypoint.sh index aa4cd20..3dcf9a7 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -61,6 +61,14 @@ export OPENCLAW_GATEWAY_PORT="${OPENCLAW_GATEWAY_PORT:-18800}" log() { echo "[entrypoint] $*"; } warn() { echo "[entrypoint] WARNING: $*" >&2; } +# ── Readiness sentinel ──────────────────────────────────────────── +# Present during init; deleted just before gateway starts. +# Kubernetes readiness probe: test ! -f /home/agent/vol/.openclaw-initializing +SENTINEL="${VOL}/.openclaw-initializing" +mkdir -p "${VOL}" +touch "${SENTINEL}" +log "Readiness sentinel created at ${SENTINEL}" + # ── Warn on missing required vars ──────────────────────────────── for var in OPENCLAW_GATEWAY_TOKEN OPENCLAW_DEFAULT_MODEL OPENCLAW_AGENT_NAME \ ANTHROPIC_API_KEY ANTHROPIC_MODEL ANTHROPIC_SMALL_FAST_MODEL PAI_AGENT_NAME; do @@ -522,6 +530,8 @@ fi # Run gateway in background. OpenClaw manages its own internal restarts. # The sleep loop keeps the container alive if the gateway process exits. log "Starting OpenClaw gateway on port ${OPENCLAW_GATEWAY_PORT}..." +rm -f "${SENTINEL}" +log "Readiness sentinel removed — pod is ready." /home/agent/.npm-global/bin/openclaw gateway & while true; do