From c37a0535531a30e1d5c43f3811f2676af208f38b Mon Sep 17 00:00:00 2001 From: Tariq Ibrahim Date: Tue, 8 Oct 2024 21:34:01 -0700 Subject: [PATCH] drop NewInformer method in favour of NewInformerWithOptions Signed-off-by: Tariq Ibrahim --- cmd/nvidia-k8s-vgpu-dm/main.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/cmd/nvidia-k8s-vgpu-dm/main.go b/cmd/nvidia-k8s-vgpu-dm/main.go index ba8fa61..c7b9d13 100644 --- a/cmd/nvidia-k8s-vgpu-dm/main.go +++ b/cmd/nvidia-k8s-vgpu-dm/main.go @@ -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]) }, @@ -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