mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-17 20:00:07 +00:00
FSWatcher.Run() spawned a goroutine with no exit mechanism, causing a goroutine leak. Add a ctx context.Context parameter to Run() so the goroutine can exit cleanly when the context is canceled, and defer-close the underlying fsnotify watcher on exit. For kube-proxy, the existing ctx from runLoop() is passed directly. For the flexvolume prober, ctx is stored in flexVolumeProber at construction time via GetDynamicPluginProber(), representing the component lifetime (kubelet/controller-manager), which is the appropriate scope for this long-running watcher.