Skip to content

Commit 00fd7a3

Browse files
committed
Updated Listen logic of informer manager to start snapshot sync
1 parent 961ec42 commit 00fd7a3

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

pkg/kubernetes/informers.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package kubernetes
1818

1919
import (
2020
"context"
21+
"fmt"
2122
"sync"
2223
"time"
2324

@@ -316,5 +317,16 @@ func (im *InformerManager) Listen() (stopCh <-chan struct{}) {
316317
}
317318

318319
}
320+
321+
go im.snapshotInformerFactory.Start(im.stopCh)
322+
cacheSync := im.snapshotInformerFactory.WaitForCacheSync(im.stopCh)
323+
// TODO: remove
324+
fmt.Print(cacheSync)
325+
for _, isSynced := range cacheSync {
326+
if !isSynced {
327+
return
328+
}
329+
}
330+
319331
return im.stopCh
320332
}

pkg/kubernetes/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ type InformerManager struct {
5656
snapshotInformerFactory externalversions.SharedInformerFactory
5757

5858
// main signal
59-
stopCh (<-chan struct{})
59+
stopCh <-chan struct{}
6060

6161
// node informer
6262
nodeInformer cache.SharedInformer

0 commit comments

Comments
 (0)