aboutsummaryrefslogtreecommitdiffstats
path: root/arthur/apis/kubernetes/pods.py
diff options
context:
space:
mode:
authorGravatar Joe Banks <[email protected]>2024-03-30 20:57:04 +0000
committerGravatar Joe Banks <[email protected]>2024-03-30 20:57:04 +0000
commit8a80f1936f2dab8a7ed216578c7f3743a68bd428 (patch)
tree14370267effb9d44995e03ba8b98f4c032bdf6c3 /arthur/apis/kubernetes/pods.py
parentMerge pull request #149 from python-discord/integrate-sentry (diff)
add pods command
Diffstat (limited to 'arthur/apis/kubernetes/pods.py')
-rw-r--r--arthur/apis/kubernetes/pods.py12
1 files changed, 12 insertions, 0 deletions
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)