Skip to content

Commit

Permalink
nfd-master: check nfd api informer cache sync result
Browse files Browse the repository at this point in the history
Bail out if there were errors in syncing the cache of any resource.
  • Loading branch information
marquiz committed Jul 25, 2024
1 parent 493aa0c commit ea3243f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/nfd-master/nfd-api-controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,15 @@ func newNfdController(config *restclient.Config, nfdApiControllerOptions nfdApiC

// Start informers
informerFactory.Start(c.stopChan)
informerFactory.WaitForCacheSync(c.stopChan)
now := time.Now()
ret := informerFactory.WaitForCacheSync(c.stopChan)
for res, ok := range ret {
if !ok {
return nil, fmt.Errorf("informer cache failed to sync resource %s", res)
}
}

klog.InfoS("informer caches synced", "duration", time.Since(now))

return c, nil
}
Expand Down

0 comments on commit ea3243f

Please sign in to comment.