diff --git a/pkg/controller/ehpa/hpa.go b/pkg/controller/ehpa/hpa.go index bfc772a2d..c28d68c35 100644 --- a/pkg/controller/ehpa/hpa.go +++ b/pkg/controller/ehpa/hpa.go @@ -189,7 +189,7 @@ func (c *EffectiveHPAController) GetHPAMetrics(ctx context.Context, ehpa *autosc if metric.Type == autoscalingv2.ResourceMetricSourceType { name, err := GetPredictionMetricName(metric.Resource.Name) if err != nil { - return nil, err + continue } customMetric := &autoscalingv2.PodsMetricSource{ @@ -251,8 +251,6 @@ func GetPredictionMetricName(Name v1.ResourceName) (string, error) { switch Name { case v1.ResourceCPU: return known.MetricNamePodCpuUsage, nil - case v1.ResourceMemory: - return known.MetricNamePodMemoryUsage, nil default: return "", fmt.Errorf("resource name not predictable") } diff --git a/pkg/controller/ehpa/predict.go b/pkg/controller/ehpa/predict.go index 6bd5e0086..04792d414 100644 --- a/pkg/controller/ehpa/predict.go +++ b/pkg/controller/ehpa/predict.go @@ -131,7 +131,7 @@ func (c *EffectiveHPAController) NewPredictionObject(ehpa *autoscalingapi.Effect if metric.Type == autoscalingv2.ResourceMetricSourceType { metricName, err := GetPredictionMetricName(metric.Resource.Name) if err != nil { - return nil, err + continue } predictionMetrics = append(predictionMetrics, predictionapi.PredictionMetric{ diff --git a/pkg/known/const.go b/pkg/known/const.go index edd00394b..26c23cd19 100644 --- a/pkg/known/const.go +++ b/pkg/known/const.go @@ -5,6 +5,5 @@ const ( ) const ( - MetricNamePodCpuUsage = "pod_cpu_usage" - MetricNamePodMemoryUsage = "pod_memory_usage" + MetricNamePodCpuUsage = "crane_pod_cpu_usage" ) diff --git a/pkg/metricprovider/provider.go b/pkg/metricprovider/provider.go index 4ffe56960..6ff2c4699 100644 --- a/pkg/metricprovider/provider.go +++ b/pkg/metricprovider/provider.go @@ -157,8 +157,6 @@ func (p *MetricProvider) GetMetricBySelector(ctx context.Context, namespace stri if info.Metric == known.MetricNamePodCpuUsage { metric.Value = *resource.NewMilliQuantity(averageValue, resource.DecimalSI) - } else if info.Metric == known.MetricNamePodMemoryUsage { - metric.Value = *resource.NewMilliQuantity(averageValue, resource.BinarySI) } matchingMetrics = append(matchingMetrics, metric) @@ -189,11 +187,6 @@ func ListAllLocalMetrics() []provider.CustomMetricInfo { Namespaced: true, Metric: known.MetricNamePodCpuUsage, }, - { - GroupResource: schema.GroupResource{Group: "", Resource: "pods"}, - Namespaced: true, - Metric: known.MetricNamePodMemoryUsage, - }, } }