Skip to content

Commit d63e771

Browse files
committed
add optional ns to get_pod_exit_stats
1 parent d3ef211 commit d63e771

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/warnet/k8s.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import tempfile
55
from pathlib import Path
66
from time import sleep
7+
from typing import Optional
78

89
import yaml
910
from kubernetes import client, config, watch
@@ -58,10 +59,12 @@ def get_mission(mission: str) -> list[V1Pod]:
5859
return crew
5960

6061

61-
def get_pod_exit_status(pod_name):
62+
def get_pod_exit_status(pod_name, namespace: Optional[str] = None):
63+
if not namespace:
64+
namespace = get_default_namespace()
6265
try:
6366
sclient = get_static_client()
64-
pod = sclient.read_namespaced_pod(name=pod_name, namespace=get_default_namespace())
67+
pod = sclient.read_namespaced_pod(name=pod_name, namespace=namespace)
6568
for container_status in pod.status.container_statuses:
6669
if container_status.state.terminated:
6770
return container_status.state.terminated.exit_code

0 commit comments

Comments
 (0)