From 50622623f23f5730992df0e158e28504b402e5b2 Mon Sep 17 00:00:00 2001 From: rickbrouwer Date: Sat, 2 Nov 2024 13:07:37 +0100 Subject: [PATCH] Remove unnecessary validate in kubernetes workload and cpu mem (#6286) * Remove validate cpu memory scaler Signed-off-by: rickbrouwer * Remove validate kubernetes workload Signed-off-by: rickbrouwer --------- Signed-off-by: rickbrouwer --- pkg/scalers/cpu_memory_scaler.go | 11 ----------- pkg/scalers/kubernetes_workload_scaler.go | 4 ---- 2 files changed, 15 deletions(-) diff --git a/pkg/scalers/cpu_memory_scaler.go b/pkg/scalers/cpu_memory_scaler.go index ce845414966..8da440ab77e 100644 --- a/pkg/scalers/cpu_memory_scaler.go +++ b/pkg/scalers/cpu_memory_scaler.go @@ -29,10 +29,6 @@ type cpuMemoryMetadata struct { MetricType v2.MetricTargetType } -func (m *cpuMemoryMetadata) Validate() error { - return nil -} - // NewCPUMemoryScaler creates a new cpuMemoryScaler func NewCPUMemoryScaler(resourceName v1.ResourceName, config *scalersconfig.ScalerConfig) (Scaler, error) { logger := InitializeLogger(config, "cpu_memory_scaler") @@ -42,13 +38,6 @@ func NewCPUMemoryScaler(resourceName v1.ResourceName, config *scalersconfig.Scal return nil, fmt.Errorf("error parsing %s metadata: %w", resourceName, err) } - if err := meta.Validate(); err != nil { - if meta.MetricType == "" { - return nil, fmt.Errorf("metricType is required") - } - return nil, fmt.Errorf("validation error: %w", err) - } - return &cpuMemoryScaler{ metadata: meta, resourceName: resourceName, diff --git a/pkg/scalers/kubernetes_workload_scaler.go b/pkg/scalers/kubernetes_workload_scaler.go index a2a658f7cba..3023d8ed08a 100644 --- a/pkg/scalers/kubernetes_workload_scaler.go +++ b/pkg/scalers/kubernetes_workload_scaler.go @@ -87,10 +87,6 @@ func parseKubernetesWorkloadMetadata(config *scalersconfig.ScalerConfig) (kubern } meta.podSelector = selector - if err := meta.Validate(); err != nil { - return meta, err - } - return meta, nil }