Skip to content

Commit

Permalink
Fix #89 by copying the MatchLabels map instead of referencing it. (#90)
Browse files Browse the repository at this point in the history
Signed-off-by: Johann Fuechsl <[email protected]>
  • Loading branch information
jfuechsl authored and arjunrn committed Nov 7, 2019
1 parent 0790bc3 commit 1209500
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/collector/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,9 @@ func ParseHPAMetrics(hpa *autoscalingv2.HorizontalPodAutoscaler) ([]*MetricConfi
if metric.Type == autoscalingv2.ExternalMetricSourceType &&
metric.External.Metric.Selector != nil &&
metric.External.Metric.Selector.MatchLabels != nil {
config.Config = metric.External.Metric.Selector.MatchLabels
for k, v := range metric.External.Metric.Selector.MatchLabels {
config.Config[k] = v
}
}

annotationConfigs, present := parser.GetAnnotationConfig(typeName.Metric.Name, typeName.Type)
Expand Down

0 comments on commit 1209500

Please sign in to comment.