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:
parent
81495216a7
commit
1262946a3e
1 changed files with 7 additions and 5 deletions
|
|
@ -860,8 +860,10 @@ def wait_for_easyhaproxy_discovery(kubectl_cmd: str, expected_host: str, timeout
|
|||
|
||||
time.sleep(1)
|
||||
|
||||
# Step 4: Poll until the backend returns 200 (not just any response)
|
||||
print(f" → Waiting for backend to return 200...")
|
||||
# Step 4: Poll until HAProxy returns a real response (not 503/000).
|
||||
# 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:
|
||||
try:
|
||||
result = subprocess.run(
|
||||
|
|
@ -872,10 +874,10 @@ def wait_for_easyhaproxy_discovery(kubectl_cmd: str, expected_host: str, timeout
|
|||
timeout=5
|
||||
)
|
||||
http_code = result.stdout.strip()
|
||||
if http_code == "200":
|
||||
print(f" ✓ Backend is ready (HTTP 200)")
|
||||
if http_code and http_code not in ("000", "503"):
|
||||
print(f" ✓ Backend is ready (HTTP {http_code})")
|
||||
return True
|
||||
if http_code and http_code != "000":
|
||||
if http_code:
|
||||
print(f" … Backend not ready yet (HTTP {http_code}), retrying...")
|
||||
except Exception:
|
||||
pass
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue