From 7c784d4bbdd4409784afa20a3cb716b8515fc62c Mon Sep 17 00:00:00 2001 From: alfredeen Date: Tue, 10 Sep 2024 16:05:27 +0200 Subject: [PATCH] Added response limit to method signature --- serve_event_listener/status_data.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/serve_event_listener/status_data.py b/serve_event_listener/status_data.py index 5e231fe..cdf2428 100644 --- a/serve_event_listener/status_data.py +++ b/serve_event_listener/status_data.py @@ -122,11 +122,17 @@ def set_k8s_api_client(self, k8s_api_client: client.CoreV1Api, namespace: str): self.k8s_api_client = k8s_api_client self.namespace = namespace - def fetch_status_from_k8s_api(self, release: str) -> Tuple[str, str, str]: + def fetch_status_from_k8s_api( + self, release: str, response_limit: int = 1000 + ) -> Tuple[str, str, str]: """ Get the actual status of a release from k8s via the client API. Because this can be as costly operation it is only used at critical times such as deleted pods. + Parameters: + - release (str): The release + - response_limit (int): The maximum number of objects to return from the k8s API call. + Returns: - Tuple[str, str, str]: The status of the pod, container message, pod message @@ -141,7 +147,7 @@ def fetch_status_from_k8s_api(self, release: str) -> Tuple[str, str, str]: try: api_response = self.k8s_api_client.list_namespaced_pod( - self.namespace, limit=500, timeout_seconds=120, watch=False + self.namespace, limit=response_limit, timeout_seconds=120, watch=False ) for pod in api_response.items: