Skip to content

Commit

Permalink
fix panic when use cpu/memory and other scaler together (kedacore#1298)
Browse files Browse the repository at this point in the history
Signed-off-by: silenceper <[email protected]>
  • Loading branch information
silenceper authored Oct 29, 2020
1 parent e1e0f36 commit a1c611f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ func (p *KedaProvider) GetExternalMetric(namespace string, metricSelector labels
scalerName := strings.Replace(fmt.Sprintf("%T", scaler), "*scalers.", "", 1)

for _, metricSpec := range metricSpecs {
//skip cpu/memory resource scaler
if metricSpec.External == nil {
continue
}
// Filter only the desired metric
if strings.EqualFold(metricSpec.External.Metric.Name, info.Metric) {
metrics, err := scaler.GetMetrics(context.TODO(), info.Metric, metricSelector)
Expand Down

0 comments on commit a1c611f

Please sign in to comment.