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
This commit is contained in:
2025-10-04 10:08:37 -03:00
parent a73aa4a76f
commit 472eec01c9

View File

@@ -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