Skip to content
This repository was archived by the owner on Jul 11, 2023. It is now read-only.

Commit a2b6ed3

Browse files
committed
Resolve PR comments
Signed-off-by: Keith Mattix II <[email protected]>
1 parent be516de commit a2b6ed3

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

pkg/k8s/informers/informers.go

+6-5
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,18 @@ type InformerCollectionOption func(*InformerCollection)
4747
// NewInformerCollection creates a new InformerCollection
4848
func NewInformerCollection(meshName string, stop <-chan struct{}, opts ...InformerCollectionOption) (*InformerCollection, error) {
4949
ic := &InformerCollection{
50-
meshName: meshName,
51-
informers: map[InformerKey]*informer{},
50+
meshName: meshName,
51+
informers: map[InformerKey]*informer{},
52+
selectedInformers: map[InformerKey]struct{}{},
5253
}
5354

55+
// Execute all of the given options (e.g. set clients, set custom stores, etc.)
5456
for _, opt := range opts {
5557
if opt != nil {
5658
opt(ic)
5759
}
5860
}
5961

60-
// Initialize informers
6162
informerInitHandlerMap := map[InformerKey]informerInit{
6263
// Kubernetes
6364
InformerKeyNamespace: ic.initNamespaceMonitor,
@@ -84,7 +85,7 @@ func NewInformerCollection(meshName string, stop <-chan struct{}, opts ...Inform
8485
}
8586

8687
if len(ic.selectedInformers) == 0 {
87-
// Initialize all informers
88+
// Select all informers
8889
ic.selectedInformers = map[InformerKey]struct{}{
8990
InformerKeyNamespace: {},
9091
InformerKeyService: {},
@@ -191,7 +192,7 @@ func (ic *InformerCollection) run(stop <-chan struct{}) error {
191192
continue
192193
}
193194

194-
go informer.Run(make(chan struct{}))
195+
go informer.Run(stop)
195196
names = append(names, string(name))
196197
log.Info().Msgf("Waiting for %s informer cache sync...", name)
197198
hasSynced = append(hasSynced, informer.HasSynced)

pkg/k8s/informers/init.go

-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ func (ic *InformerCollection) initNamespaceMonitor() {
4141
if customStore != nil {
4242
informer.customStore = customStore
4343
}
44-
4544
ic.informers[InformerKeyNamespace] = informer
4645
}
4746

0 commit comments

Comments
 (0)