update(k8s): add storage and instance type

This commit is contained in:
Aleksandr Tcitlionok
2024-12-05 08:05:15 +00:00
parent 55dd06584c
commit 0ec23d8122
4 changed files with 99 additions and 32 deletions

View File

@@ -87,19 +87,27 @@ def display_kubernetes_nodes():
table.add_column("Node Name", style="white")
table.add_column("CPU", justify="right", style="yellow")
table.add_column("Memory (MiB)", justify="right", style="cyan")
table.add_column("Pods Allocatable", justify="right", style="green")
table.add_column("Storage", style="green")
table.add_column("Instance Type", style="blue")
table.add_column("Pods Allocatable", justify="right", style="magenta")
nodes = v1.list_node()
for node in nodes.items:
storage = node.metadata.annotations.get("node.kubernetes.io/storage", "N/A")
instance_type = node.metadata.labels.get("beta.kubernetes.io/instance-type", "N/A")
table.add_row(
node.metadata.name,
node.status.capacity.get("cpu"),
f"{round(convert_memory_to_mib(node.status.capacity.get('memory')), 2)}",
storage,
instance_type,
node.status.allocatable.get("pods")
)
console.print(table)
def display_namespace_usage():
console = Console()
config.load_incluster_config()
@@ -143,5 +151,3 @@ if __name__ == "__main__":
display_virtual_machines()
display_kubernetes_nodes()
display_namespace_usage()
console.print("\n🚀 [bold cyan]Dashboard rendering complete![/bold cyan] 🚀")