<#7052 feat(executor): support immediate GC cleanu...
# flyte-github
a
#7052 feat(executor): support immediate GC cleanup when MaxTTL &lt;= 0 Pull request opened by mvanhorn Tracking issue Closes #7008 Why are the changes needed? The TaskAction garbage collector (added in #6994) currently rejects
MaxTTL <= 0
with a validation error at startup (
executor/setup.go:125
). Operators who want aggressive cleanup of completed TaskActions have no way to express "delete immediately on each GC cycle." The issue proposes treating
MaxTTL <= 0
as "immediate deletion" - a natural extension of the existing TTL behavior where smaller values mean faster cleanup. What changes were proposed in this pull request? 1. Removed the
MaxTTL <= 0
validation error
in
executor/setup.go
. GC now starts with any MaxTTL value when interval > 0. 2. Added immediate-deletion logic in
executor/pkg/controller/garbage_collector.go
. When
maxTTL <= 0
, the collect() function uses a far-future cutoff (
9999-12-31.23-59
) so all terminal TaskActions are eligible for deletion regardless of their completed time. The existing label-based string comparison (
completedTime < cutoff
) works unchanged since the far-future value is lexicographically greater than any real timestamp. 3. Updated config documentation in
executor/pkg/config/config.go
to note the
<= 0
behavior in the pflag help text. | MaxTTL value | Behavior | | ------------ | --------------------------------------------------------- | | > 0 | Delete terminal TaskActions older than MaxTTL (unchanged) | | <= 0 | Delete all terminal TaskActions on each GC cycle | Existing configurations with positive MaxTTL are not affected. How was this patch tested? Added two Ginkgo test cases in `executor/pkg/controller/garbage_collector_test.go`: • `maxTTL = 0`: verifies a recently-completed TaskAction is deleted immediately • `maxTTL = -1h`: verifies negative values behave the same as zero Ran
go fmt ./...
and
go vet ./...
locally - both pass clean. This contribution was developed with AI assistance (Claude Code + Codex). Labels • added: New GC behavior for
MaxTTL <= 0
. •
main
• #6583 • feat(executor): support immediate GC cleanup when MaxTTL <= 0 👈 flyteorg/flyte