Skip to content

Commit fd282ef

Browse files
committed
control: use namespace log in down
1 parent fe2399f commit fd282ef

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/warnet/control.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020
BITCOINCORE_CONTAINER,
2121
COMMANDER_CHART,
2222
COMMANDER_CONTAINER,
23-
LOGGING_NAMESPACE,
2423
)
2524
from .k8s import (
2625
delete_pod,
2726
get_default_namespace,
2827
get_mission,
28+
get_namespaces,
2929
get_pod,
3030
get_pods,
3131
pod_log,
@@ -118,8 +118,6 @@ def down():
118118
"""Bring down a running warnet quickly"""
119119
console.print("[bold yellow]Bringing down the warnet...[/bold yellow]")
120120

121-
namespaces = [get_default_namespace(), LOGGING_NAMESPACE]
122-
123121
def uninstall_release(namespace, release_name):
124122
cmd = f"helm uninstall {release_name} --namespace {namespace} --wait=false"
125123
subprocess.Popen(cmd, shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
@@ -134,13 +132,15 @@ def delete_pod(pod_name, namespace):
134132
futures = []
135133

136134
# Uninstall Helm releases
137-
for namespace in namespaces:
138-
command = f"helm list --namespace {namespace} -o json"
135+
for namespace in get_namespaces():
136+
command = f"helm list --namespace {namespace.metadata.name} -o json"
139137
result = run_command(command)
140138
if result:
141139
releases = json.loads(result)
142140
for release in releases:
143-
futures.append(executor.submit(uninstall_release, namespace, release["name"]))
141+
futures.append(
142+
executor.submit(uninstall_release, namespace.metadata.name, release["name"])
143+
)
144144

145145
# Delete remaining pods
146146
pods = get_pods()

0 commit comments

Comments
 (0)