Skip to content

Commit

Permalink
drop NewInformer method in favour of NewInformerWithOptions
Browse files Browse the repository at this point in the history
Signed-off-by: Tariq Ibrahim <tibrahim@nvidia.com>
  • Loading branch information
tariq1890 committed Oct 9, 2024
1 parent 8aa05a7 commit c37a053
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions cmd/nvidia-k8s-vgpu-dm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,10 @@ func continuouslySyncVGPUConfigChanges(clientset *kubernetes.Clientset, vGPUConf
fields.OneTermEqualSelector("metadata.name", nodeNameFlag),
)

_, controller := cache.NewInformer(
listWatch, &corev1.Node{}, 0,
cache.ResourceEventHandlerFuncs{
opts := cache.InformerOptions{
ListerWatcher: listWatch,
ObjectType: &corev1.Node{},
Handler: cache.ResourceEventHandlerFuncs{
AddFunc: func(obj interface{}) {
vGPUConfig.Set(obj.(*corev1.Node).Labels[vGPUConfigLabel])
},
Expand All @@ -256,8 +257,9 @@ func continuouslySyncVGPUConfigChanges(clientset *kubernetes.Clientset, vGPUConf
}
},
},
)

ResyncPeriod: 0,
}
_, controller := cache.NewInformerWithOptions(opts)
stop := make(chan struct{})
go controller.Run(stop)
return stop
Expand Down

0 comments on commit c37a053

Please sign in to comment.