From f1305ffcbce1153679e573160a7c7d9e6bafcd87 Mon Sep 17 00:00:00 2001 From: Jennifer Chen Date: Tue, 5 Nov 2024 21:03:56 +0000 Subject: [PATCH] Check target source prior to updating DPAI from existing status --- .../autoscaling/workload/model/pod_autoscaler.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/clusteragent/autoscaling/workload/model/pod_autoscaler.go b/pkg/clusteragent/autoscaling/workload/model/pod_autoscaler.go index 86f823176d7687..47c9dceab60fd9 100644 --- a/pkg/clusteragent/autoscaling/workload/model/pod_autoscaler.go +++ b/pkg/clusteragent/autoscaling/workload/model/pod_autoscaler.go @@ -246,10 +246,13 @@ func (p *PodAutoscalerInternal) SetDeleted() { // UpdateFromStatus updates the PodAutoscalerInternal from an existing status. // It assumes the PodAutoscalerInternal is empty so it's not emptying existing data. func (p *PodAutoscalerInternal) UpdateFromStatus(status *datadoghq.DatadogPodAutoscalerStatus) { - activeScalingValues := p.getActiveScalingValues() - + activeScalingValues := &p.scalingValues if status.Horizontal != nil { if status.Horizontal.Target != nil { + if status.Horizontal.Target.Source == "Local" { + activeScalingValues = &p.localScalingValues + } + horizontalScalingValues := &HorizontalScalingValues{ Source: status.Horizontal.Target.Source, Timestamp: status.Horizontal.Target.GeneratedAt.Time,