You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The HPAProvider caches HPA resources and recreates associated metrics collectors, should the HPA resource change. I expect it to not recreate collectors if the HPA didn't change.
Actual Behavior
HPAs with external metric collectors (e.g. Prometheus) are modified at each step (call of updateHPAs), thus bypassing the caching logic which causes the recreation of the metrics collectors.
Expected Behavior
The HPAProvider caches HPA resources and recreates associated metrics collectors, should the HPA resource change. I expect it to not recreate collectors if the HPA didn't change.
Actual Behavior
HPAs with external metric collectors (e.g. Prometheus) are modified at each step (call of
updateHPAs
), thus bypassing the caching logic which causes the recreation of the metrics collectors.This happens because of the way the metric config is created for external metrics in
ParseHPAMetrics
.The Config field is set to the address of the MatchLabels map in the HPA resource object: https://github.com/zalando-incubator/kube-metrics-adapter/blob/master/pkg/collector/collector.go#L216
Later (https://github.com/zalando-incubator/kube-metrics-adapter/blob/master/pkg/collector/collector.go#L227) this map is modified, thus modifying the HPA resource object.
The fix, in my opinion, would be to perform a copy of the MatchLabels map to the Config field.
Steps to Reproduce the Problem
Specifications
The text was updated successfully, but these errors were encountered: