From d683704593bf130c7267867c8ccd2b341e86a81d Mon Sep 17 00:00:00 2001 From: andersonid Date: Tue, 30 Sep 2025 17:37:09 -0300 Subject: [PATCH] Fix: Integrate historical analysis validations in cluster status endpoint --- app/api/routes.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/api/routes.py b/app/api/routes.py index 5a825b1..a4e07c7 100644 --- a/app/api/routes.py +++ b/app/api/routes.py @@ -68,6 +68,15 @@ async def get_cluster_status( # Group pods by namespace for the frontend namespaces_data = {} + pod_validations_map = {} + + # Create a map of pod validations (static + historical) + for validation in all_validations: + pod_key = f"{validation.namespace}/{validation.pod_name}" + if pod_key not in pod_validations_map: + pod_validations_map[pod_key] = [] + pod_validations_map[pod_key].append(validation) + for pod in pods: namespace = pod.namespace if namespace not in namespaces_data: @@ -80,7 +89,8 @@ async def get_cluster_status( # Add pod to namespace pod_name = pod.name - pod_validations = validation_service.validate_pod_resources(pod) + pod_key = f"{namespace}/{pod_name}" + pod_validations = pod_validations_map.get(pod_key, []) # Convert pod to the format expected by frontend pod_data = {