File tree 2 files changed +12
-9
lines changed
2 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -60,15 +60,16 @@ def debug_log(tank: str):
60
60
61
61
@bitcoin .command ()
62
62
@click .argument ("pattern" , type = str , required = True )
63
+ @click .option ("--tank" , type = str , required = False , help = "Filter by tank name" )
63
64
@click .option ("--show-k8s-timestamps" , is_flag = True , default = False , show_default = True )
64
65
@click .option ("--no-sort" , is_flag = True , default = False , show_default = True )
65
- def grep_logs (pattern : str , show_k8s_timestamps : bool , no_sort : bool ):
66
+ def grep_logs (pattern : str , tank : str , show_k8s_timestamps : bool , no_sort : bool ):
66
67
"""
67
68
Grep combined bitcoind logs using regex <pattern>
68
69
"""
69
70
70
71
try :
71
- tanks = get_mission ("tank" )
72
+ tanks = get_mission ("tank" , tank )
72
73
except MaxRetryError as e :
73
74
print (f"{ e } " )
74
75
sys .exit (1 )
Original file line number Diff line number Diff line change @@ -30,13 +30,15 @@ def get_pods() -> V1PodList:
30
30
return pod_list
31
31
32
32
33
- def get_mission (mission : str ) -> list [V1PodList ]:
34
- pods = get_pods ()
35
- crew = []
36
- for pod in pods .items :
37
- if "mission" in pod .metadata .labels and pod .metadata .labels ["mission" ] == mission :
38
- crew .append (pod )
39
- return crew
33
+ def get_mission (mission : str , tank_name : str = None ) -> list :
34
+ config .load_kube_config ()
35
+ v1 = client .CoreV1Api ()
36
+ pods = v1 .list_pod_for_all_namespaces (label_selector = f"mission={ mission } " )
37
+
38
+ if tank_name :
39
+ return [pod for pod in pods .items if pod .metadata .name == tank_name ]
40
+ return pods .items
41
+
40
42
41
43
42
44
def get_pod_exit_status (pod_name ):
You can’t perform that action at this time.
0 commit comments