fix(elimination): stop hanging when WatchListClient is enabled

Merged
DM
25d ago
+136-4

Summary

TrackUntilEliminated hangs until its timeout when the consumer is built with client-go v0.35+, where the WatchListClient feature gate is on by default; for example, helm uninstall and dismiss in tools built on nelm v1 legacy stop at Waiting for resources elimination although the resources are already gone. Workaround until this lands: KUBE_FEATURE_WatchListClient=false.

What

  • The elimination tracker passes the reflector's list and watch options to the API server and only adds the metadata.name=<name> field selector, like the other trackers in this repo already do.
  • With WatchListClient on, tracking returns as soon as the resource is gone. Against an API server with WatchList disabled, client-go falls back to a regular LIST.
  • In list+watch mode (client-go v0.29.3, as pinned here) the watch now starts from the resourceVersion of the list instead of "now", so a deletion between LIST and WATCH is no longer missed.
  • VERIFIED: on kind v1.33 with client-go v0.35.9, with the API server's WatchList gate both on and off, for ConfigMaps, Namespaces and custom resources, both absent and deleted during tracking.

Why

ListFunc/WatchFunc replaced the incoming options with a fixed ListOptions{FieldSelector: ...}, dropping sendInitialEvents, allowWatchBookmarks and resourceVersionMatch. The server then serves a plain watch, never sends the k8s.io/initial-events-end bookmark the reflector waits for, and the informer never syncs. Opting this tracker out of WatchList via IsWatchListSemanticsUnSupported was considered; it keeps the LIST/WATCH race above and relies on a mode client-go is phasing out.