From 17ff834efd155d8d482f9deb36973f8eab2b27bb Mon Sep 17 00:00:00 2001 From: Robusta Runner Date: Sat, 2 Mar 2024 09:04:29 +0200 Subject: [PATCH 1/2] Update simple.py --- robusta_krr/strategies/simple.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/robusta_krr/strategies/simple.py b/robusta_krr/strategies/simple.py index da71531d..f7a11dfd 100644 --- a/robusta_krr/strategies/simple.py +++ b/robusta_krr/strategies/simple.py @@ -55,6 +55,8 @@ class SimpleStrategy(BaseStrategy[SimpleStrategySettings]): History: {history_duration} hours Step: {timeframe_duration} minutes + All parameters can be customized. For example: `krr simple --cpu_percentile=90 --memory_buffer_percentage=15 --history_duration=24 --timeframe_duration=0.5` + This strategy does not work with objects with HPA defined (Horizontal Pod Autoscaler). If HPA is defined for CPU or Memory, the strategy will return "?" for that resource. From cf9533e34d22a45156d3cc56bb5a16defdc50a75 Mon Sep 17 00:00:00 2001 From: Robusta Runner Date: Sat, 2 Mar 2024 09:33:19 +0200 Subject: [PATCH 2/2] Fix bug that caused a fallback to loading pod names from the APIServer and not Prometheus --- .../prometheus/metrics_service/prometheus_metrics_service.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/robusta_krr/core/integrations/prometheus/metrics_service/prometheus_metrics_service.py b/robusta_krr/core/integrations/prometheus/metrics_service/prometheus_metrics_service.py index c628de7a..4b673094 100644 --- a/robusta_krr/core/integrations/prometheus/metrics_service/prometheus_metrics_service.py +++ b/robusta_krr/core/integrations/prometheus/metrics_service/prometheus_metrics_service.py @@ -190,6 +190,7 @@ async def load_pods(self, object: K8sObjectData, period: datetime.timedelta) -> }}[{period_literal}] """ ) + replicasets = replicasets["result"] pod_owners = [replicaset["metric"]["replicaset"] for replicaset in replicasets] pod_owner_kind = "ReplicaSet" @@ -211,6 +212,7 @@ async def load_pods(self, object: K8sObjectData, period: datetime.timedelta) -> ) """ ) + related_pods_result = related_pods_result["result"] if related_pods_result == []: return [] @@ -231,6 +233,7 @@ async def load_pods(self, object: K8sObjectData, period: datetime.timedelta) -> }} == 1 """ ) + pods_status_result = pods_status_result["result"] current_pods_set |= {pod["metric"]["pod"] for pod in pods_status_result} del pods_status_result