From 120950078c9b21bcee0dae7a1011b94d1e25ab18 Mon Sep 17 00:00:00 2001 From: Johann Fuechsl Date: Thu, 7 Nov 2019 14:38:26 +0100 Subject: [PATCH] Fix #89 by copying the MatchLabels map instead of referencing it. (#90) Signed-off-by: Johann Fuechsl --- pkg/collector/collector.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/collector/collector.go b/pkg/collector/collector.go index a2953af4..d6f1473a 100644 --- a/pkg/collector/collector.go +++ b/pkg/collector/collector.go @@ -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)