File tree Expand file tree Collapse file tree 2 files changed +17
-11
lines changed Expand file tree Collapse file tree 2 files changed +17
-11
lines changed Original file line number Diff line number Diff line change @@ -144,7 +144,7 @@ def delete_pod(pod_name, namespace):
144
144
145
145
# Delete remaining pods
146
146
pods = get_pods ()
147
- for pod in pods . items :
147
+ for pod in pods :
148
148
futures .append (executor .submit (delete_pod , pod .metadata .name , pod .metadata .namespace ))
149
149
150
150
# Wait for all tasks to complete and print results
@@ -312,7 +312,7 @@ def _logs(pod_name: str, follow: bool):
312
312
if pod_name == "" :
313
313
try :
314
314
pods = get_pods ()
315
- pod_list = [item .metadata .name for item in pods . items ]
315
+ pod_list = [item .metadata .name for item in pods ]
316
316
except Exception as e :
317
317
print (f"Could not fetch any pods in namespace { namespace } : { e } " )
318
318
return
Original file line number Diff line number Diff line change @@ -35,13 +35,19 @@ def get_dynamic_client() -> DynamicClient:
35
35
return DynamicClient (client .ApiClient ())
36
36
37
37
38
- def get_pods () -> V1PodList :
38
+ def get_pods () -> list [ V1Pod ] :
39
39
sclient = get_static_client ()
40
- try :
41
- pod_list : V1PodList = sclient .list_namespaced_pod (get_default_namespace ())
42
- except Exception as e :
43
- raise e
44
- return pod_list
40
+ pods : list [V1Pod ] = []
41
+ namespaces = get_namespaces ()
42
+ for ns in namespaces :
43
+ namespace = ns .metadata .name
44
+ try :
45
+ pod_list : V1PodList = sclient .list_namespaced_pod (namespace )
46
+ for pod in pod_list .items :
47
+ pods .append (pod )
48
+ except Exception as e :
49
+ raise e
50
+ return pods
45
51
46
52
47
53
def get_pod (name : str , namespace : Optional [str ] = None ) -> V1Pod :
@@ -51,10 +57,10 @@ def get_pod(name: str, namespace: Optional[str] = None) -> V1Pod:
51
57
return sclient .read_namespaced_pod (name = name , namespace = namespace )
52
58
53
59
54
- def get_mission (mission : str ) -> list [V1PodList ]:
60
+ def get_mission (mission : str ) -> list [V1Pod ]:
55
61
pods = get_pods ()
56
- crew = []
57
- for pod in pods . items :
62
+ crew : list [ V1Pod ] = []
63
+ for pod in pods :
58
64
if "mission" in pod .metadata .labels and pod .metadata .labels ["mission" ] == mission :
59
65
crew .append (pod )
60
66
return crew
You can’t perform that action at this time.
0 commit comments