From 349e04e9f9dfedd78d43a89df29368888ff4af40 Mon Sep 17 00:00:00 2001 From: naveenpaul1 Date: Mon, 7 Aug 2023 12:40:18 +0530 Subject: [PATCH] Skip hpav2 resources if metrics type is Resource Signed-off-by: naveenpaul1 --- pkg/system/autoscaler.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/system/autoscaler.go b/pkg/system/autoscaler.go index a047e8f4d..1d996b6b9 100644 --- a/pkg/system/autoscaler.go +++ b/pkg/system/autoscaler.go @@ -59,6 +59,13 @@ func (r *Reconciler) reconcileAutoscaler() error { return err } case nbv1.AutoscalerTypeHPAV2: + if r.AdapterHPA.Spec.Metrics[0].Type == autoscalingv2.ResourceMetricSourceType { + r.Logger.Debugf("HPAV2 autoscaler type is %s, skipping HPAV2 resource creation", autoscalingv2.ResourceMetricSourceType) + if err := r.ReconcileObject(r.AdapterHPA, r.reconcileAdapterHPA); err != nil { + return err + } + return nil + } prometheus, err := getPrometheus(log, prometheusNamespace) if err != nil { return err