acoustic-carpenter-78188
06/24/2026, 12:25 AMTaskAction CRDs were never garbage-collected on a busy dev cluster (~19k Completed piled up, oldest well past the 1h TTL). Two independent GC bugs:
1. First sweep deferred a full interval. GarbageCollector.Start used time.NewTicker, whose first tick fires only after a full interval (default 30m). So the first collection was always delayed by the whole interval, and any restart sooner than the interval reset the ticker before it fired — under active redeploys, GC never ran.
2. GC list failed against the cache. collect() lists with `Limit`/`Continue` pagination, but GC was given the manager's cache-backed client. The controller-runtime cache doesn't support the Continue list option, so once a run had more than one page (>500) of terminal actions, every cycle failed:
garbage collection cycle failed: continue list option is not supported by the cache
(This surfaced as soon as fix #1 let GC actually run.)
Together these meant GC effectively never collected on any cluster with sustained churn.
What changes were proposed in this pull request?
• Initial sweep: run gc.collect(ctx) once immediately on Start, before entering the ticker loop.
• Paginated list via APIReader: add an uncached client.Reader (mgr.GetAPIReader()) and list through it (the API server supports Continue); deletes stay on the cached client.
How was this patch tested?
garbage_collector_test.go (envtest):
• sweep immediately on Start — with a long interval (ticker won't fire), Start must still delete an expired TaskAction via the initial sweep. Fails without fix #1 (10s timeout), passes with it.
• paginate across multiple pages — lowers gcPageSize and creates several pages of expired actions to exercise the Continue loop end-to-end.
• Existing delete/retain/empty cases still pass.
Full GarbageCollector suite green.
Labels
• fixed
Check all the applicable boxes
• All new and existing tests passed.
• All commits are signed-off.
flyteorg/flyteacoustic-carpenter-78188
06/24/2026, 5:51 AM