From f380ef8b617ea5ca5c8d2ef52740144135339895 Mon Sep 17 00:00:00 2001 From: Kushagra Date: Thu, 29 Dec 2022 10:57:43 +0000 Subject: [PATCH 1/2] Misleading message when there are no metrics. --- pkg/controller/podautoscaler/replica_calculator.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/controller/podautoscaler/replica_calculator.go b/pkg/controller/podautoscaler/replica_calculator.go index c981073417c..6ce2f6c43fb 100644 --- a/pkg/controller/podautoscaler/replica_calculator.go +++ b/pkg/controller/podautoscaler/replica_calculator.go @@ -79,7 +79,7 @@ func (c *ReplicaCalculator) GetResourceReplicas(ctx context.Context, currentRepl removeMetricsForPods(metrics, ignoredPods) removeMetricsForPods(metrics, unreadyPods) if len(metrics) == 0 { - return 0, 0, 0, time.Time{}, fmt.Errorf("did not receive metrics for any ready pods") + return 0, 0, 0, time.Time{}, fmt.Errorf("did not receive metrics for targetted pods (pods might be unready)") } requests, err := calculatePodRequests(podList, container, resource) @@ -191,7 +191,7 @@ func (c *ReplicaCalculator) calcPlainMetricReplicas(metrics metricsclient.PodMet removeMetricsForPods(metrics, unreadyPods) if len(metrics) == 0 { - return 0, 0, fmt.Errorf("did not receive metrics for any ready pods") + return 0, 0, fmt.Errorf("did not receive metrics for targetted pods (pods might be unready)") } usageRatio, usage := metricsclient.GetMetricUsageRatio(metrics, targetUsage) From 80384bbb552055fb19376eb2d4ccd2cd61f8a267 Mon Sep 17 00:00:00 2001 From: Kushagra Date: Thu, 29 Dec 2022 17:55:17 +0000 Subject: [PATCH 2/2] spelling mistake rectified --- pkg/controller/podautoscaler/replica_calculator.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/controller/podautoscaler/replica_calculator.go b/pkg/controller/podautoscaler/replica_calculator.go index 6ce2f6c43fb..e84f6362dc4 100644 --- a/pkg/controller/podautoscaler/replica_calculator.go +++ b/pkg/controller/podautoscaler/replica_calculator.go @@ -79,7 +79,7 @@ func (c *ReplicaCalculator) GetResourceReplicas(ctx context.Context, currentRepl removeMetricsForPods(metrics, ignoredPods) removeMetricsForPods(metrics, unreadyPods) if len(metrics) == 0 { - return 0, 0, 0, time.Time{}, fmt.Errorf("did not receive metrics for targetted pods (pods might be unready)") + return 0, 0, 0, time.Time{}, fmt.Errorf("did not receive metrics for targeted pods (pods might be unready)") } requests, err := calculatePodRequests(podList, container, resource) @@ -191,7 +191,7 @@ func (c *ReplicaCalculator) calcPlainMetricReplicas(metrics metricsclient.PodMet removeMetricsForPods(metrics, unreadyPods) if len(metrics) == 0 { - return 0, 0, fmt.Errorf("did not receive metrics for targetted pods (pods might be unready)") + return 0, 0, fmt.Errorf("did not receive metrics for targeted pods (pods might be unready)") } usageRatio, usage := metricsclient.GetMetricUsageRatio(metrics, targetUsage)