Commit f793ddff authored by Dr. Stefan Schimanski's avatar Dr. Stefan Schimanski

Remove FIFO dependency from SchedulerLoop

parent ae4673e8
...@@ -68,9 +68,18 @@ func NewScheduler(c *config.Config, fw types.Framework, client *client.Client, r ...@@ -68,9 +68,18 @@ func NewScheduler(c *config.Config, fw types.Framework, client *client.Client, r
// an ordering (vs interleaving) of operations that's easier to reason about. // an ordering (vs interleaving) of operations that's easier to reason about.
q := queuer.New(podUpdates) q := queuer.New(podUpdates)
algorithm := NewSchedulerAlgorithm(fw, podUpdates)
podDeleter := NewDeleter(fw, q) podDeleter := NewDeleter(fw, q)
podReconciler := NewPodReconciler(fw, client, q, podDeleter) podReconciler := NewPodReconciler(fw, client, q, podDeleter)
bo := backoff.New(c.InitialPodBackoff.Duration, c.MaxPodBackoff.Duration)
errorHandler := NewErrorHandler(fw, bo, q)
binder := NewBinder(fw)
startLatch := make(chan struct{}) startLatch := make(chan struct{})
eventBroadcaster := record.NewBroadcaster() eventBroadcaster := record.NewBroadcaster()
...@@ -84,18 +93,17 @@ func NewScheduler(c *config.Config, fw types.Framework, client *client.Client, r ...@@ -84,18 +93,17 @@ func NewScheduler(c *config.Config, fw types.Framework, client *client.Client, r
podtask.InstallDebugHandlers(fw.Tasks(), mux) podtask.InstallDebugHandlers(fw.Tasks(), mux)
}) })
return NewSchedulerLoop(c, fw, client, recorder, podUpdates, q, startLatch), podReconciler return NewSchedulerLoop(client, algorithm, recorder, q.Yield, errorHandler.Error, binder, startLatch), podReconciler
} }
func NewSchedulerLoop(c *config.Config, fw types.Framework, client *client.Client, func NewSchedulerLoop(client *client.Client, algorithm *SchedulerAlgorithm,
recorder record.EventRecorder, podUpdates queue.FIFO, q *queuer.Queuer, recorder record.EventRecorder, nextPod func() *api.Pod, error func(pod *api.Pod, schedulingErr error),
started chan<- struct{}) *SchedulerLoop { binder *Binder, started chan<- struct{}) *SchedulerLoop {
bo := backoff.New(c.InitialPodBackoff.Duration, c.MaxPodBackoff.Duration)
return &SchedulerLoop{ return &SchedulerLoop{
algorithm: NewSchedulerAlgorithm(fw, podUpdates), algorithm: algorithm,
binder: NewBinder(fw), binder: binder,
nextPod: q.Yield, nextPod: nextPod,
error: NewErrorHandler(fw, bo, q).Error, error: error,
recorder: recorder, recorder: recorder,
client: client, client: client,
started: started, started: started,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment