Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 19 additions & 11 deletions operator/hack/infra_manager/kwok.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,17 +134,25 @@ def _apply_kwok_manifest(base_url: str, manifest: str) -> None:
def _wait_for_stage_crd(timeout: int) -> None:
"""Wait until the KWOK Stage CRD is established and visible via discovery."""
console.print("[yellow]\u2139\ufe0f Waiting for KWOK Stage CRD to be established...[/yellow]")
ok, _, stderr = run_kubectl(
[
"wait",
"--for=condition=Established",
f"crd/{KWOK_STAGE_CRD}",
f"--timeout={timeout}s",
],
timeout=timeout + 10,
)
if not ok:
raise RuntimeError(f"KWOK Stage CRD not established after {timeout}s: {stderr[:500]}")
deadline = time.monotonic() + timeout
last_error = ""
while time.monotonic() < deadline:
wait_timeout = max(1, min(10, int(deadline - time.monotonic())))
ok, _, stderr = run_kubectl(
[
"wait",
"--for=condition=Established",
f"crd/{KWOK_STAGE_CRD}",
f"--timeout={wait_timeout}s",
],
timeout=wait_timeout + 5,
)
if ok:
break
last_error = stderr
time.sleep(2)
else:
raise RuntimeError(f"KWOK Stage CRD not established after {timeout}s: {last_error[:500]}")

deadline = time.monotonic() + timeout
last_error = ""
Expand Down
Loading