소스 검색

Deep Copy Labels (#3206) (#3208)

Signed-off-by: Nik Willwerth <nwillwerth@kubecost.com>
nik-kc 11 달 전
부모
커밋
55bbbc097a
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      pkg/costmodel/costmodel.go

+ 2 - 1
pkg/costmodel/costmodel.go

@@ -3,6 +3,7 @@ package costmodel
 import (
 	"errors"
 	"fmt"
+	"maps"
 	"math"
 	"regexp"
 	"strconv"
@@ -386,7 +387,7 @@ func (cm *CostModel) ComputeCostData(cli prometheusClient.Client, cp costAnalyze
 			ns := pod.Namespace
 
 			nsLabels := namespaceLabelsMapping[ns+","+clusterID]
-			podLabels := pod.Labels
+			podLabels := maps.Clone(pod.Labels)
 			if podLabels == nil {
 				podLabels = make(map[string]string)
 			}