Skip to content

Commit

Permalink
Merge pull request #5726 from RainbowMango/automated-cherry-pick-of-#…
Browse files Browse the repository at this point in the history
…5685-upstream-release-1.9

Automated cherry pick of #5685: add ResourceSummary deep copy in general-estimator
  • Loading branch information
karmada-bot authored Oct 23, 2024
2 parents 6b00f7b + 10f3152 commit 7c6c860
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/estimator/client/general.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ func (ge *GeneralEstimator) MaxAvailableReplicas(_ context.Context, clusters []*
}

func (ge *GeneralEstimator) maxAvailableReplicas(cluster *clusterv1alpha1.Cluster, replicaRequirements *workv1alpha2.ReplicaRequirements) int32 {
resourceSummary := cluster.Status.ResourceSummary
//Note: resourceSummary must be deep-copied before using in the function to avoid modifying the original data structure.
resourceSummary := cluster.Status.ResourceSummary.DeepCopy()
if resourceSummary == nil {
return 0
}
Expand Down

0 comments on commit 7c6c860

Please sign in to comment.