From 472eec01c98df17daf7750914d85c572ff2e0010 Mon Sep 17 00:00:00 2001 From: andersonid Date: Sat, 4 Oct 2025 10:08:37 -0300 Subject: [PATCH] Filter out build pods and non-running pods from analysis - Filter pods with status not in [Running, Pending] - Filter pods ending with -build (S2I build pods) - Prevent build pods from polluting workload analysis - Improve analysis accuracy by focusing on active workloads --- app/core/kubernetes_client.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/core/kubernetes_client.py b/app/core/kubernetes_client.py index f198092..e080ef5 100644 --- a/app/core/kubernetes_client.py +++ b/app/core/kubernetes_client.py @@ -145,6 +145,14 @@ class K8sClient: # Filter system namespaces if self._is_system_namespace(pod.metadata.namespace, include_system_namespaces): continue + + # Filter out non-running pods (build pods, completed pods, etc.) + if pod.status.phase not in ["Running", "Pending"]: + continue + + # Filter out build pods (pods ending with -build) + if pod.metadata.name.endswith('-build'): + continue # Calculate total pod resources total_cpu_requests = 0.0 total_memory_requests = 0.0