16
16
from rich .prompt import Confirm , Prompt
17
17
from rich .table import Table
18
18
19
- from .constants import COMMANDER_CHART , LOGGING_NAMESPACE
19
+ from .constants import COMMANDER_CHART
20
20
from .k8s import (
21
21
delete_pod ,
22
22
get_default_namespace ,
23
23
get_mission ,
24
+ get_namespaces ,
24
25
get_pods ,
25
26
pod_log ,
26
27
snapshot_bitcoin_datadir ,
@@ -112,8 +113,6 @@ def down():
112
113
"""Bring down a running warnet quickly"""
113
114
console .print ("[bold yellow]Bringing down the warnet...[/bold yellow]" )
114
115
115
- namespaces = [get_default_namespace (), LOGGING_NAMESPACE ]
116
-
117
116
def uninstall_release (namespace , release_name ):
118
117
cmd = f"helm uninstall { release_name } --namespace { namespace } --wait=false"
119
118
subprocess .Popen (cmd , shell = True , stdout = subprocess .DEVNULL , stderr = subprocess .DEVNULL )
@@ -128,13 +127,15 @@ def delete_pod(pod_name, namespace):
128
127
futures = []
129
128
130
129
# Uninstall Helm releases
131
- for namespace in namespaces :
132
- command = f"helm list --namespace { namespace } -o json"
130
+ for namespace in get_namespaces () :
131
+ command = f"helm list --namespace { namespace . metadata . name } -o json"
133
132
result = run_command (command )
134
133
if result :
135
134
releases = json .loads (result )
136
135
for release in releases :
137
- futures .append (executor .submit (uninstall_release , namespace , release ["name" ]))
136
+ futures .append (
137
+ executor .submit (uninstall_release , namespace .metadata .name , release ["name" ])
138
+ )
138
139
139
140
# Delete remaining pods
140
141
pods = get_pods ()
0 commit comments