diff --git a/staging/src/k8s.io/dynamic-resource-allocation/resourceslice/resourceslicecontroller.go b/staging/src/k8s.io/dynamic-resource-allocation/resourceslice/resourceslicecontroller.go index 984cc57579d..ea4169079a6 100644 --- a/staging/src/k8s.io/dynamic-resource-allocation/resourceslice/resourceslicecontroller.go +++ b/staging/src/k8s.io/dynamic-resource-allocation/resourceslice/resourceslicecontroller.go @@ -479,7 +479,7 @@ func (c *Controller) initInformer(ctx context.Context) error { indexers, ) c.sliceStore = cache.NewIntegerResourceVersionMutationCache(logger, informer.GetStore(), informer.GetIndexer(), c.mutationCacheTTL, true /* includeAdds */) - handler, err := informer.AddEventHandler(cache.ResourceEventHandlerFuncs{ + handler, err := informer.AddEventHandlerWithOptions(cache.ResourceEventHandlerFuncs{ AddFunc: func(obj any) { slice, ok := obj.(*resourceapi.ResourceSlice) if !ok { @@ -522,7 +522,7 @@ func (c *Controller) initInformer(ctx context.Context) error { c.queue.AddAfter(slice.Spec.Pool.Name, c.syncDelay) logger.V(5).Info("Scheduled sync", "poolName", slice.Spec.Pool.Name, "at", time.Now().Add(c.syncDelay)) }, - }) + }, cache.HandlerOptions{Logger: &logger}) if err != nil { return fmt.Errorf("registering event handler on the ResourceSlice informer: %w", err) } @@ -533,7 +533,7 @@ func (c *Controller) initInformer(ctx context.Context) error { defer c.wg.Done() defer logger.V(3).Info("ResourceSlice informer has stopped") defer c.queue.ShutDown() // Once we get here, we must have been asked to stop. - informer.Run(ctx.Done()) + informer.RunWithContext(ctx) }() for !handler.HasSynced() { select {