chore: bump kubedog to stop leaking informers after tracking

Merged
DM
18d ago
+4-4

Summary

Bumps github.com/werf/kubedog to the merge commit of werf/kubedog#406 on kubedog main (1ed920d). A long-lived process that runs nelm release actions over and over with tracking (for example, a controller that deploys a release on every reconcile) no longer accumulates informers that hold the cache of a resource type for a whole namespace after each action ends. Before, the memory such a process held grew with every deploy until it restarted.

What

  • go.mod/go.sum: github.com/werf/kubedog v0.13.1-0.20261029011008-97f4f131413e → v0.13.1-0.20261103160714-1ed920dee18b. The range 97f4f13..1ed920d is the single commit of werf/kubedog#406.
  • After a release install, upgrade, uninstall or rollback with tracking finishes and its context is canceled, the shared informers it started stop and release their caches, even when the trackers stopped reading before an informer delivered all its events. Applies to the Pod, Deployment, StatefulSet, DaemonSet, Job, Canary and ReplicaSet trackers, the generic resource state and events watchers and the event informer that pkg/dyntracker uses.
  • A fatal watch error raised after the action finished no longer blocks the informer: it is dropped once the informer factory is stopped instead of waiting forever on the watch error channel.
  • When a Job, DaemonSet, StatefulSet or Pod tracker fails halfway through starting, the informers it already started are released.
  • While tracking runs, every event is delivered as before: channel capacities and send order are unchanged, nothing is dropped. Tracking results, progress output and errors do not change.
  • Library API: kubedog adds the exported helper utils.SendOrDone(ctx, ch, v). Nothing in the nelm API changes.
  • go.mod: golang.org/x/sync v0.20.0 moves from the indirect to the direct block, same version. pkg/resource/spec/patches_debug_test.go (#785) already imports it directly; go mod tidy on main without this bump makes the same change.
  • UNVERIFIED: not reproduced against a real cluster. kubedog covers every changed handler with a regression test on a fake dynamic client that shows the informer goroutines stay alive without the fix and exit with it.

Why

Informer event handlers run in the client-go listener goroutine and sent to tracker channels without watching for cancellation. When a handler had more events to deliver than the channel could buffer at the moment the tracker stopped reading (e.g. the initial Add events for several Pods of a Deployment that is already ready), the send blocked forever, the informer stayed in wg.Wait() after the stop signal, and its indexer stayed referenced. 38643e9 in kubedog (brought in by #780) fixed this for the ReplicaSet informer only. Bigger channel buffers only move the threshold, since the number of objects an informer replays on start is unbounded.

BEGIN_COMMIT_OVERRIDE
fix: stop leaking informers and their caches after tracking
END_COMMIT_OVERRIDE