Skip to content

Commit

Permalink
WIP: register Node/Update event to plugins which has Node/Add only, d…
Browse files Browse the repository at this point in the history
…oesn't have Node/Update
  • Loading branch information
sanposhiho committed Dec 13, 2023
1 parent 0c64592 commit 7d2e383
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions pkg/scheduler/scheduler.go
Expand Up @@ -385,17 +385,45 @@ func buildQueueingHintMap(es []framework.EnqueueExtensions) internalqueue.Queuei
// cannot be moved by any regular cluster event.
// So, we can just ignore such EventsToRegister here.

registerNodeAdded := false
registerNodeUpdated := false
for _, event := range events {
fn := event.QueueingHintFn
if fn == nil || !utilfeature.DefaultFeatureGate.Enabled(features.SchedulerQueueingHints) {
fn = defaultQueueingHintFn
}

if event.Event.Resource == framework.Node {
if event.Event.ActionType&framework.Add == 0 {
registerNodeAdded = true
}
if event.Event.ActionType&framework.Update == 0 {
registerNodeUpdated = true
}
}

queueingHintMap[event.Event] = append(queueingHintMap[event.Event], &internalqueue.QueueingHintFunction{
PluginName: e.Name(),
QueueingHintFn: fn,
})
}
if registerNodeAdded && !registerNodeUpdated {
// Temporally fix for the issue https://github.com/kubernetes/kubernetes/issues/109437
// Currently, NodeAdded QueueingHint could not be called because of preCheck.
// It's definitely not something expected for plugin developers,
// and registering NodeUpdated event is the only mitigation for now.
//
// So, here, we'll register NodeUpdated event for plugins that has NodeAdded event, but doesn't have NodeUpdated event.
// It has a bad impact for the requeuing efficiency though, a lot better than some Pods being stuch in the
// unschedulable pod pool.
queueingHintMap[framework.ClusterEvent{Resource: framework.Node, ActionType: framework.Update}] =
append(queueingHintMap[framework.ClusterEvent{Resource: framework.Node, ActionType: framework.Update}],
&internalqueue.QueueingHintFunction{
PluginName: e.Name(),
QueueingHintFn: defaultQueueingHintFn,
},
)
}
}
return queueingHintMap
}
Expand Down

0 comments on commit 7d2e383

Please sign in to comment.