Skip to content

Commit ae9f213

Browse files
committed
use namespace log in down
1 parent 170213c commit ae9f213

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/warnet/control.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@
1616
from rich.prompt import Confirm, Prompt
1717
from rich.table import Table
1818

19-
from .constants import COMMANDER_CHART, LOGGING_NAMESPACE
19+
from .constants import COMMANDER_CHART
2020
from .k8s import (
2121
delete_pod,
2222
get_default_namespace,
2323
get_mission,
24+
get_namespaces,
2425
get_pods,
2526
pod_log,
2627
snapshot_bitcoin_datadir,
@@ -112,8 +113,6 @@ def down():
112113
"""Bring down a running warnet quickly"""
113114
console.print("[bold yellow]Bringing down the warnet...[/bold yellow]")
114115

115-
namespaces = [get_default_namespace(), LOGGING_NAMESPACE]
116-
117116
def uninstall_release(namespace, release_name):
118117
cmd = f"helm uninstall {release_name} --namespace {namespace} --wait=false"
119118
subprocess.Popen(cmd, shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
@@ -128,13 +127,15 @@ def delete_pod(pod_name, namespace):
128127
futures = []
129128

130129
# 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"
133132
result = run_command(command)
134133
if result:
135134
releases = json.loads(result)
136135
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+
)
138139

139140
# Delete remaining pods
140141
pods = get_pods()

0 commit comments

Comments
 (0)