Skip to content

Commit

Permalink
koord-scheduler: fix PodGroupController panic when init (#659)
Browse files Browse the repository at this point in the history
Signed-off-by: Joseph <[email protected]>
  • Loading branch information
eahydra authored Sep 23, 2022
1 parent 92b281a commit 5aca824
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions pkg/scheduler/plugins/coscheduling/controller/podgroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,14 @@ func NewPodGroupController(client kubernetes.Interface,
pgClient schedclientset.Interface, podGroupManager *core.PodGroupManager, recorder events.EventRecorder) *PodGroupController {

ctrl := &PodGroupController{
eventRecorder: recorder,
pgQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "PodGroup"),
pgManager: podGroupManager,
eventRecorder: recorder,
pgManager: podGroupManager,
pgClient: pgClient,
pgLister: pgInformer.Lister(),
podLister: podInformer.Lister(),
pgListerSynced: pgInformer.Informer().HasSynced,
podListerSynced: podInformer.Informer().HasSynced,
pgQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "PodGroup"),
}

pgInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
Expand All @@ -83,12 +88,6 @@ func NewPodGroupController(client kubernetes.Interface,
AddFunc: ctrl.podAdded,
UpdateFunc: ctrl.podUpdated,
})

ctrl.pgLister = pgInformer.Lister()
ctrl.podLister = podInformer.Lister()
ctrl.pgListerSynced = pgInformer.Informer().HasSynced
ctrl.podListerSynced = podInformer.Informer().HasSynced
ctrl.pgClient = pgClient
return ctrl
}

Expand Down

0 comments on commit 5aca824

Please sign in to comment.