Skip to content

Commit 28ad860

Browse files
committed
add optional ns to wait_for_pod
1 parent a1b93ea commit 28ad860

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/warnet/k8s.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,10 +341,12 @@ def pod_log(pod_name, container_name=None, follow=False, namespace: Optional[str
341341
raise Exception(json.loads(e.body.decode("utf-8"))["message"]) from None
342342

343343

344-
def wait_for_pod(pod_name, timeout_seconds=10):
344+
def wait_for_pod(pod_name, timeout_seconds=10, namespace: Optional[str] = None):
345+
if not namespace:
346+
namespace = get_default_namespace()
345347
sclient = get_static_client()
346348
while timeout_seconds > 0:
347-
pod = sclient.read_namespaced_pod_status(name=pod_name, namespace=get_default_namespace())
349+
pod = sclient.read_namespaced_pod_status(name=pod_name, namespace=namespace)
348350
if pod.status.phase != "Pending":
349351
return
350352
sleep(1)

0 commit comments

Comments
 (0)