1
0
Fork 0

Refine Kubernetes E2E polling logic to check backend readiness beyond HTTP 503

- Updated polling step to consider non-503 responses (e.g., 200/401/403) as backend readiness.
- Improved logging to reflect updated readiness criteria.
- Enhanced robustness by distinguishing between transient and configured backend states.
This commit is contained in:
Joao Gilberto Magalhaes 2026-02-18 17:26:24 -05:00
parent 81495216a7
commit 1262946a3e

View file

@ -860,8 +860,10 @@ def wait_for_easyhaproxy_discovery(kubectl_cmd: str, expected_host: str, timeout
time.sleep(1) time.sleep(1)
# Step 4: Poll until the backend returns 200 (not just any response) # Step 4: Poll until HAProxy returns a real response (not 503/000).
print(f" → Waiting for backend to return 200...") # 503 means the backend is not ready yet; 200/401/403/etc. all mean the
# backend is up and HAProxy has fully configured the route.
print(f" → Waiting for backend to become ready (non-503)...")
while time.time() - start_time < timeout: while time.time() - start_time < timeout:
try: try:
result = subprocess.run( result = subprocess.run(
@ -872,10 +874,10 @@ def wait_for_easyhaproxy_discovery(kubectl_cmd: str, expected_host: str, timeout
timeout=5 timeout=5
) )
http_code = result.stdout.strip() http_code = result.stdout.strip()
if http_code == "200": if http_code and http_code not in ("000", "503"):
print(f" ✓ Backend is ready (HTTP 200)") print(f" ✓ Backend is ready (HTTP {http_code})")
return True return True
if http_code and http_code != "000": if http_code:
print(f" … Backend not ready yet (HTTP {http_code}), retrying...") print(f" … Backend not ready yet (HTTP {http_code}), retrying...")
except Exception: except Exception:
pass pass