fix bug of #2447: when replicaDivisionPreference is Weighted and WeightPreference is nil
Signed-off-by: changzhen <changzhen5@huawei.com>
This commit is contained in:
parent
102ac7de39
commit
8b4eb7b310
|
@ -245,7 +245,8 @@ func isTopologyIgnored(placement *policyv1alpha1.Placement) bool {
|
||||||
// If the replica division preference is 'static weighted', ignore the declaration specified by spread constraints.
|
// If the replica division preference is 'static weighted', ignore the declaration specified by spread constraints.
|
||||||
if strategy != nil && strategy.ReplicaSchedulingType == policyv1alpha1.ReplicaSchedulingTypeDivided &&
|
if strategy != nil && strategy.ReplicaSchedulingType == policyv1alpha1.ReplicaSchedulingTypeDivided &&
|
||||||
strategy.ReplicaDivisionPreference == policyv1alpha1.ReplicaDivisionPreferenceWeighted &&
|
strategy.ReplicaDivisionPreference == policyv1alpha1.ReplicaDivisionPreferenceWeighted &&
|
||||||
(len(strategy.WeightPreference.StaticWeightList) != 0 && strategy.WeightPreference.DynamicWeight == "") {
|
(strategy.WeightPreference == nil ||
|
||||||
|
len(strategy.WeightPreference.StaticWeightList) != 0 && strategy.WeightPreference.DynamicWeight == "") {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue