Skip to content

Commit 5b2f51a

Browse files
committed
adds an option to specify whether informers should fail on error, which defaults to false to maintain existing compatibility
1 parent 400b9ff commit 5b2f51a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pkg/controller/mpi_job_controller.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ func NewMPIJobControllerWithClock(
348348

349349
// Set up error handlers for informers
350350
klog.Info("Setting up informer error handlers")
351-
informers := map[string]cache.SharedIndexInformer{
351+
informers := map[string]cache.SharedInformer{
352352
"configMapInformer": configMapInformer.Informer(),
353353
"secretInformer": secretInformer.Informer(),
354354
"serviceInformer": serviceInformer.Informer(),
@@ -364,12 +364,13 @@ func NewMPIJobControllerWithClock(
364364
cache.DefaultWatchErrorHandler(r, err)
365365

366366
if errors.IsUnauthorized(err) || errors.IsForbidden(err) {
367-
klog.Fatalf("Unable to sync cache for informer %s: %s. Exiting.", name, err)
367+
klog.Fatalf("Unable to sync cache for informer %s: %s. Requesting controller to exit.", name, err)
368368
}
369369
})
370370

371371
if err != nil {
372-
klog.Fatalf("Unable to set error handler for informer %s: %s. Exiting.", name, err)
372+
// return NewMPIJobControllerWithClock(...) (nil, error)
373+
return nil, fmt.Errorf("unable to set error handler for informer %s: %s", name, err)
373374
}
374375
}
375376

0 commit comments

Comments
 (0)