Skip to content

Commit

Permalink
Merge pull request #4139 from yanfeng1992/fix-scheduler-eventfilter
Browse files Browse the repository at this point in the history
EnqueueAffectedBindings and enqueueAffectedCRBs add schedulerNameFilter
  • Loading branch information
karmada-bot committed Oct 18, 2023
2 parents 3eba2a9 + 27971f4 commit e2e33a5
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions pkg/scheduler/event_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,9 @@ func (s *Scheduler) enqueueAffectedBindings(cluster *clusterv1alpha1.Cluster) er
// for scheduling or its status has not been synced to the
// cache. Just enqueue the binding to avoid missing the cluster
// update event.
s.onResourceBindingRequeue(binding, metrics.ClusterChanged)
if schedulerNameFilter(s.schedulerName, binding.Spec.SchedulerName) {
s.onResourceBindingRequeue(binding, metrics.ClusterChanged)
}
continue
}
affinityIndex := getAffinityIndex(placementPtr.ClusterAffinities, binding.Status.SchedulerObservedAffinityName)
Expand All @@ -273,7 +275,9 @@ func (s *Scheduler) enqueueAffectedBindings(cluster *clusterv1alpha1.Cluster) er
fallthrough
case util.ClusterMatches(cluster, *affinity):
// If the cluster manifest match the affinity, add it to the queue, trigger rescheduling
s.onResourceBindingRequeue(binding, metrics.ClusterChanged)
if schedulerNameFilter(s.schedulerName, binding.Spec.SchedulerName) {
s.onResourceBindingRequeue(binding, metrics.ClusterChanged)
}
}
}

Expand All @@ -299,7 +303,9 @@ func (s *Scheduler) enqueueAffectedCRBs(cluster *clusterv1alpha1.Cluster) error
// for scheduling or its status has not been synced to the
// cache. Just enqueue the binding to avoid missing the cluster
// update event.
s.onClusterResourceBindingRequeue(binding, metrics.ClusterChanged)
if schedulerNameFilter(s.schedulerName, binding.Spec.SchedulerName) {
s.onClusterResourceBindingRequeue(binding, metrics.ClusterChanged)
}
continue
}
affinityIndex := getAffinityIndex(placementPtr.ClusterAffinities, binding.Status.SchedulerObservedAffinityName)
Expand All @@ -314,7 +320,9 @@ func (s *Scheduler) enqueueAffectedCRBs(cluster *clusterv1alpha1.Cluster) error
fallthrough
case util.ClusterMatches(cluster, *affinity):
// If the cluster manifest match the affinity, add it to the queue, trigger rescheduling
s.onClusterResourceBindingRequeue(binding, metrics.ClusterChanged)
if schedulerNameFilter(s.schedulerName, binding.Spec.SchedulerName) {
s.onClusterResourceBindingRequeue(binding, metrics.ClusterChanged)
}
}
}

Expand Down

0 comments on commit e2e33a5

Please sign in to comment.