Skip to content

Commit

Permalink
nfd-gc: check that node informer cache sync succeeded
Browse files Browse the repository at this point in the history
  • Loading branch information
marquiz committed Jul 26, 2024
1 parent bd8d74d commit 454d443
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pkg/nfd-gc/nfd-gc.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package nfdgarbagecollector

import (
"context"
"fmt"
"time"

topologyclientset "github.com/k8stopologyawareschedwg/noderesourcetopology-api/pkg/generated/clientset/versioned"
Expand Down Expand Up @@ -208,7 +209,15 @@ func (n *nfdGarbageCollector) startNodeInformer() error {

// start informers
n.factory.Start(n.stopChan)
n.factory.WaitForCacheSync(n.stopChan)

start := time.Now()
ret := n.factory.WaitForCacheSync(n.stopChan)
for res, ok := range ret {
if !ok {
return fmt.Errorf("node informer cache failed to sync (%s)", res)
}
}
klog.InfoS("node informer cache synced", "duration", time.Since(start))

return nil
}
Expand Down

0 comments on commit 454d443

Please sign in to comment.