fix(readiness): Only check external Qdrant in network mode
The readiness probe incorrectly tried to connect to an external Qdrant service even when using memory or persistent mode (embedded Qdrant). This caused pods to never become ready in Kubernetes deployments using the default configuration. Root cause: - In memory/persistent modes, QDRANT_URL env var is NOT set - Readiness check used default 'http://qdrant:6333' anyway - Tried to connect to non-existent service - Connection failed -> 503 -> pod stuck in not-ready state Fix: - Only check external Qdrant health if QDRANT_URL is explicitly set (network mode) - For embedded modes (memory/persistent), report status as 'embedded' without blocking - Background scanner tasks don't block readiness (already non-blocking via anyio.start_soon) This allows pods to become ready immediately when using embedded Qdrant, while still validating external Qdrant connectivity in network mode. Fixes: Kubernetes pods failing readiness check with default Qdrant configuration 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1172,13 +1172,15 @@ def get_app(transport: str = "sse", enabled_apps: list[str] | None = None):
|
||||
checks["auth_configured"] = "error: credentials not set"
|
||||
is_ready = False
|
||||
|
||||
# Check Qdrant status if vector sync is enabled
|
||||
# Check Qdrant status if using network mode (external Qdrant service)
|
||||
# In-memory and persistent modes use embedded Qdrant, no external service to check
|
||||
vector_sync_enabled = (
|
||||
os.getenv("VECTOR_SYNC_ENABLED", "false").lower() == "true"
|
||||
)
|
||||
if vector_sync_enabled:
|
||||
qdrant_url = os.getenv("QDRANT_URL") # Only set in network mode
|
||||
|
||||
if vector_sync_enabled and qdrant_url:
|
||||
try:
|
||||
qdrant_url = os.getenv("QDRANT_URL", "http://qdrant:6333")
|
||||
async with httpx.AsyncClient(timeout=2.0) as client:
|
||||
response = await client.get(f"{qdrant_url}/readyz")
|
||||
if response.status_code == 200:
|
||||
@@ -1189,6 +1191,9 @@ def get_app(transport: str = "sse", enabled_apps: list[str] | None = None):
|
||||
except Exception as e:
|
||||
checks["qdrant"] = f"error: {str(e)}"
|
||||
is_ready = False
|
||||
elif vector_sync_enabled:
|
||||
# Using embedded Qdrant (memory or persistent mode)
|
||||
checks["qdrant"] = "embedded"
|
||||
|
||||
status_code = 200 if is_ready else 503
|
||||
return JSONResponse(
|
||||
|
||||
Reference in New Issue
Block a user