From 79d7373ac6ecf59920ad58145871a8fb88920604 Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 28 Mar 2024 19:30:50 +0100 Subject: [PATCH] Trying the kube python lib --- core/app/handlers/core.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/app/handlers/core.py b/core/app/handlers/core.py index 657cb86..d1019b7 100644 --- a/core/app/handlers/core.py +++ b/core/app/handlers/core.py @@ -1,8 +1,15 @@ import hug +from kubernetes import client, config @hug.post('/create-room') def create_room(): - return "" + config.load_kube_config(config_file='./kubernetes-config') + v1 = client.CoreV1Api() + print("Listing pods with their IPs:") + ret = v1.list_pod_for_all_namespaces(watch=False) + for i in ret.items: + print("%s\t%s\t%s" % (i.status.pod_ip, i.metadata.namespace, i.metadata.name)) + return ret.items[0].metadata.name @hug.post('/delete-room') def delete_room(body):