Skip to content

Commit

Permalink
Remove unnecessary validate in kubernetes workload and cpu mem (#6286)
Browse files Browse the repository at this point in the history
* Remove validate cpu memory scaler

Signed-off-by: rickbrouwer <[email protected]>

* Remove validate kubernetes workload

Signed-off-by: rickbrouwer <[email protected]>

---------

Signed-off-by: rickbrouwer <[email protected]>
  • Loading branch information
rickbrouwer authored Nov 2, 2024
1 parent 4376101 commit 5062262
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 15 deletions.
11 changes: 0 additions & 11 deletions pkg/scalers/cpu_memory_scaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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,
Expand Down
4 changes: 0 additions & 4 deletions pkg/scalers/kubernetes_workload_scaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 5062262

Please sign in to comment.