From 8a80f1936f2dab8a7ed216578c7f3743a68bd428 Mon Sep 17 00:00:00 2001 From: Joe Banks Date: Sat, 30 Mar 2024 20:57:04 +0000 Subject: add pods command --- arthur/apis/kubernetes/pods.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 arthur/apis/kubernetes/pods.py (limited to 'arthur/apis/kubernetes') diff --git a/arthur/apis/kubernetes/pods.py b/arthur/apis/kubernetes/pods.py new file mode 100644 index 0000000..dfdc80c --- /dev/null +++ b/arthur/apis/kubernetes/pods.py @@ -0,0 +1,12 @@ +"""APIs for working with Kubernetes pods.""" + +from kubernetes_asyncio import client +from kubernetes_asyncio.client.api_client import ApiClient +from kubernetes_asyncio.client.models import V1PodList + + +async def list_pods(namespace: str) -> V1PodList: + """Query the Kubernetes API for a list of pods in the provided namespace.""" + async with ApiClient() as api_client: + api = client.CoreV1Api(api_client) + return await api.list_namespaced_pod(namespace=namespace) -- cgit v1.2.3