Skip to content

Commit

Permalink
Merge pull request #5685 from LivingCcj/master
Browse files Browse the repository at this point in the history
add ResourceSummary deep copy in general-estimator
  • Loading branch information
karmada-bot authored Oct 21, 2024
2 parents aca83a7 + 3a4464a commit 6a827f6
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 6a827f6

Please sign in to comment.