From ffaf3ffdb570c2f2bf3f1a649fda035a9b65be17 Mon Sep 17 00:00:00 2001 From: Roi Glinik Date: Thu, 19 Dec 2024 12:30:03 +0200 Subject: [PATCH] fix exception when theres no metrics source --- robusta_krr/core/runner.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/robusta_krr/core/runner.py b/robusta_krr/core/runner.py index 9a8b1a8..e8c6e7f 100644 --- a/robusta_krr/core/runner.py +++ b/robusta_krr/core/runner.py @@ -289,7 +289,10 @@ async def _collect_result(self) -> Result: if not clusters or len(clusters) == 1: cluster_name = clusters[0] if clusters else None # its none if krr is running inside cluster prometheus_loader = self._get_prometheus_loader(cluster_name) - cluster_summary = await prometheus_loader.get_cluster_summary() + if prometheus_loader: + cluster_summary = await prometheus_loader.get_cluster_summary() + else: + cluster_summary = {} else: cluster_summary = {} scans = await asyncio.gather(*[self._gather_object_allocations(k8s_object) for k8s_object in workloads])