fix: graceful 503 on reset() when no cluster, entrypoint connectivity check, README cluster docs
Claude
Unverified signature
bd8b9db
- Add ClusterNotAvailableError and _assert_cluster_reachable() in environment.py:
POST /reset now returns HTTP 503 with a clear message when kubectl cannot
reach the cluster, instead of a 400 or an opaque timeout.
- Catch ClusterNotAvailableError in app.py and return 503.
- Add verify_cluster_connectivity() in container-entrypoint.sh: if
KUBECONFIG_B64 is provided, fail fast at startup with a clear error if
the cluster is not reachable; warn if KUBECONFIG_B64 is absent.
- Add "Live Cluster (Hugging Face Space)" section to README documenting
the pre-connected AWS EC2 cluster and KUBECONFIG_B64 usage for
self-hosted runs.
https://claude.ai/code/session_01VMNnLkfqWJ4cCNCDpznuby
fix: expose nginx as LoadBalancer and auto-detect node IP for service probe
Jinit Shah
c856b24
Switch nginx Service to type LoadBalancer so k3s ServiceLB exposes it on
the node's IP:80. Replace port-forward hacks in container-entrypoint.sh
with auto_detect_ingress() that fetches the node ExternalIP (falling back
to InternalIP) at startup and exports INGRESS_URL_HOST + INGRESS_PORT=80.
Committed-By-Agent: claude
fix: use set +e in port-forward loop so it survives early failures
Jinit Shah
6fccaec
The nginx service only exists after reset() restores the baseline,
so the first port-forward attempts at container startup always fail.
With set -euo pipefail inherited by the subshell, a failing kubectl
command exited the loop immediately — no retries ever ran.
Use set +e inside the subshell so the loop keeps retrying every 1s
until the service is available. Also drop the output pipe (which was
itself a pipefail hazard) in favour of /dev/null redirection.
Committed-By-Agent: claude
fix: port-forward tron/nginx svc to fix service probe in HF Space
Jinit Shah
b6e9744
The cluster has no ingress controller — only ClusterIP services
(tron/nginx and tron/redis). ClusterIPs are unreachable from the
container, so the probe (127.0.0.1:8080) always returned unreachable.
Port-forward svc/nginx in the tron namespace to localhost:8080 via a
self-restarting background loop started at container startup.
Committed-By-Agent: claude
fix: auto-detect ingress external IP instead of kubectl port-forward
Jinit Shah
456c0d9
Replaces the fragile port-forward loop with a one-time lookup of the
ingress controller's LoadBalancer IP at startup. Sets INGRESS_URL_HOST
and INGRESS_PORT=80 so the service probe hits the ingress directly.
Tries nginx ingress controller first, then traefik (k3s default).
Falls back gracefully with a warning if neither is found. Manual
override via INGRESS_URL_HOST / INGRESS_PORT env vars still works.
Committed-By-Agent: claude
fix: add background kubectl port-forward for ingress probe in HF Space
Jinit Shah
ef140f2
When running against a remote k3s cluster (KUBECONFIG_B64 set), the
service probe hits 127.0.0.1:8080 but nothing is listening there.
Start a self-restarting port-forward loop in the background so the
probe can reach the cluster ingress controller.
Configurable via INGRESS_NAMESPACE (default: ingress-nginx),
INGRESS_SVC (default: ingress-nginx-controller), and INGRESS_PORT
(default: 8080). Set INGRESS_PORT_FORWARD=true to enable without
KUBECONFIG_B64.
Committed-By-Agent: claude