Skip to content

Commit

Permalink
Check target source prior to updating DPAI from existing status
Browse files Browse the repository at this point in the history
  • Loading branch information
jennchenn committed Nov 5, 2024
1 parent 1957a34 commit f1305ff
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/clusteragent/autoscaling/workload/model/pod_autoscaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit f1305ff

Please sign in to comment.