Skip to content

Commit

Permalink
add ResourceSummary deep copy in general-estimator
Browse files Browse the repository at this point in the history
Signed-off-by: LivingCcj <[email protected]>
  • Loading branch information
LivingCcj authored and RainbowMango committed Oct 23, 2024
1 parent 6b00f7b commit 10f3152
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 10f3152

Please sign in to comment.