From ea3243fb000923f5029bcca0bc9c5614c6acd188 Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Thu, 25 Jul 2024 08:49:43 +0300 Subject: [PATCH] nfd-master: check nfd api informer cache sync result Bail out if there were errors in syncing the cache of any resource. --- pkg/nfd-master/nfd-api-controller.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/nfd-master/nfd-api-controller.go b/pkg/nfd-master/nfd-api-controller.go index 18eacb241c..fa9ac738f1 100644 --- a/pkg/nfd-master/nfd-api-controller.go +++ b/pkg/nfd-master/nfd-api-controller.go @@ -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 }