Merge pull request #5685 from LivingCcj/master
add ResourceSummary deep copy in general-estimator
This commit is contained in:
commit
6a827f60bc
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue