Skip to content

Commit

Permalink
Use cache.NewInformerWithOptions as cache.NewInformer is deprecated
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Desiniotis <[email protected]>
  • Loading branch information
cdesiniotis committed Aug 26, 2024
1 parent e158844 commit d0d628a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions cmd/nvidia-mig-manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,11 @@ func ContinuouslySyncMigConfigChanges(clientset *kubernetes.Clientset, migConfig
fields.OneTermEqualSelector("metadata.name", nodeNameFlag),
)

_, controller := cache.NewInformer(
listWatch, &v1.Node{}, 0,
cache.ResourceEventHandlerFuncs{
_, controller := cache.NewInformerWithOptions(cache.InformerOptions{
ListerWatcher: listWatch,
ObjectType: &v1.Node{},
ResyncPeriod: 0,
Handler: cache.ResourceEventHandlerFuncs{
AddFunc: func(obj interface{}) {
migConfig.Set(obj.(*v1.Node).Labels[MigConfigLabel])
},
Expand All @@ -425,7 +427,7 @@ func ContinuouslySyncMigConfigChanges(clientset *kubernetes.Clientset, migConfig
}
},
},
)
})

stop := make(chan struct{})
go controller.Run(stop)
Expand Down

0 comments on commit d0d628a

Please sign in to comment.