Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/warnet/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ def _connected(end="\n"):
actual += 1
expected = int(tank.metadata.annotations["init_peers"])
print(
f"Tank {tank.metadata.name} peers expected: {expected}, actual: {actual}", end=end
f"Tank: {tank.metadata.name:<15} peers expected: {expected:<3} actual: {actual:<3}",
end=end,
)
# Even if more edges are specified, bitcoind only allows
# 8 manual outbound connections
Expand Down
22 changes: 21 additions & 1 deletion src/warnet/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from rich.text import Text
from urllib3.exceptions import MaxRetryError

from .constants import COMMANDER_MISSION, TANK_MISSION
from .constants import COMMANDER_MISSION, LIGHTNING_MISSION, TANK_MISSION
from .k8s import get_mission
from .network import _connected

Expand All @@ -20,6 +20,7 @@ def status():

try:
tanks = _get_tank_status()
lns = _get_ln_status()
scenarios = _get_deployed_scenarios()
except ConfigException as e:
print(e)
Expand Down Expand Up @@ -52,6 +53,13 @@ def status():
for tank in tanks:
table.add_row("Tank", tank["name"], tank["status"], tank["namespace"])

# Add a separator if there are both tanks and scenarios
if tanks and lns:
table.add_row("", "", "")

for ln in lns:
table.add_row("Lightning", ln["name"], ln["status"], ln["namespace"])

# Add a separator if there are both tanks and scenarios
if tanks and scenarios:
table.add_row("", "", "")
Expand Down Expand Up @@ -98,6 +106,18 @@ def _get_tank_status():
]


def _get_ln_status():
tanks = get_mission(LIGHTNING_MISSION)
return [
{
"name": tank.metadata.name,
"status": tank.status.phase.lower(),
"namespace": tank.metadata.namespace,
}
for tank in tanks
]


def _get_deployed_scenarios():
commanders = get_mission(COMMANDER_MISSION)
return [
Expand Down
Loading