Skip to content

Commit 7a05fd3

Browse files
authored
Minor fixes (#529)
1 parent ca66e50 commit 7a05fd3

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

pkg/controllers/rollout/controller.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,16 @@ func pickBindingsToRoll(allBindings []*fleetv1beta1.ClusterResourceBinding, late
233233

234234
// calculate the target number of bindings
235235
targetNumber := 0
236-
if crp.Spec.Policy.PlacementType == fleetv1beta1.PickAllPlacementType {
236+
237+
// note that if the policy will be overwritten if it is nil in this controller.
238+
switch {
239+
case crp.Spec.Policy.PlacementType == fleetv1beta1.PickAllPlacementType:
237240
// we use the scheduler picked bindings as the target number since there is no target in the CRP
238241
targetNumber = len(schedulerTargetedBinds)
239-
} else {
240-
// the CRP validation webhook should make sure this is not nil
242+
case crp.Spec.Policy.PlacementType == fleetv1beta1.PickFixedPlacementType:
243+
// we use the length of the given cluster names are targets
244+
targetNumber = len(crp.Spec.Policy.ClusterNames)
245+
default:
241246
targetNumber = int(*crp.Spec.Policy.NumberOfClusters)
242247
}
243248
klog.V(2).InfoS("Calculated the targetNumber", "clusterResourcePlacement", klog.KObj(crp),

0 commit comments

Comments
 (0)