Skip to content

Commit

Permalink
Update deprecated cache.NewInformer() to cache.NewInformerWithOptions()
Browse files Browse the repository at this point in the history
  • Loading branch information
jingyuanliang committed Sep 4, 2024
1 parent 792d4fe commit 22eb360
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions pkg/metrics/collector/netlink_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,15 @@ func createPodWatch() error {
v1.NamespaceAll,
fields.OneTermEqualSelector("spec.nodeName", nodeName),
)
_, controller := cache.NewInformer(
watchlist,
&v1.Pod{},
0,
cache.ResourceEventHandlerFuncs{
_, controller := cache.NewInformerWithOptions(cache.InformerOptions{
ListerWatcher: watchlist,
ObjectType: &v1.Pod{},
Handler: cache.ResourceEventHandlerFuncs{
AddFunc: onPodAdd,
UpdateFunc: onPodUpdate,
DeleteFunc: onPodDelete,
},
)
})

stopper := make(chan struct{})

Expand Down

0 comments on commit 22eb360

Please sign in to comment.