feat: readiness sentinel for Kubernetes
entrypoint.sh creates /home/agent/vol/.openclaw-initializing at startup and removes it just before launching the gateway. Pod is not marked ready until init (volume copy + config baking) is fully complete. deployment.yaml adds readinessProbe: exec test ! -f sentinel, with initialDelaySeconds=5, periodSeconds=5, failureThreshold=60 (5 minute window for slow storage on first deploy).
This commit is contained in:
@@ -64,6 +64,13 @@ spec:
|
|||||||
- name: vol
|
- name: vol
|
||||||
mountPath: /home/agent/vol
|
mountPath: /home/agent/vol
|
||||||
|
|
||||||
|
readinessProbe:
|
||||||
|
exec:
|
||||||
|
command: ["test", "!", "-f", "/home/agent/vol/.openclaw-initializing"]
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
periodSeconds: 5
|
||||||
|
failureThreshold: 60
|
||||||
|
|
||||||
env:
|
env:
|
||||||
|
|
||||||
# ── Required ────────────────────────────────────────────
|
# ── Required ────────────────────────────────────────────
|
||||||
|
|||||||
@@ -61,6 +61,14 @@ export OPENCLAW_GATEWAY_PORT="${OPENCLAW_GATEWAY_PORT:-18800}"
|
|||||||
log() { echo "[entrypoint] $*"; }
|
log() { echo "[entrypoint] $*"; }
|
||||||
warn() { echo "[entrypoint] WARNING: $*" >&2; }
|
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 ────────────────────────────────
|
# ── Warn on missing required vars ────────────────────────────────
|
||||||
for var in OPENCLAW_GATEWAY_TOKEN OPENCLAW_DEFAULT_MODEL OPENCLAW_AGENT_NAME \
|
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
|
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.
|
# Run gateway in background. OpenClaw manages its own internal restarts.
|
||||||
# The sleep loop keeps the container alive if the gateway process exits.
|
# The sleep loop keeps the container alive if the gateway process exits.
|
||||||
log "Starting OpenClaw gateway on port ${OPENCLAW_GATEWAY_PORT}..."
|
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 &
|
/home/agent/.npm-global/bin/openclaw gateway &
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
|
|||||||
Reference in New Issue
Block a user