feat(executor): support immediate GC cleanup when MaxTTL <= 0#7052
Open
mvanhorn wants to merge 1 commit intoflyteorg:v2from
Open
feat(executor): support immediate GC cleanup when MaxTTL <= 0#7052mvanhorn wants to merge 1 commit intoflyteorg:v2from
mvanhorn wants to merge 1 commit intoflyteorg:v2from
Conversation
When GC is enabled (interval > 0), treat MaxTTL <= 0 as "delete all terminal TaskActions immediately on each GC cycle" instead of returning a validation error. This is useful for environments that want aggressive cleanup of completed TaskActions without a retention window. Closes flyteorg#7008 Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
b496db8 to
d602c27
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tracking issue
Closes #7008
Why are the changes needed?
The TaskAction garbage collector (added in #6994) currently rejects
MaxTTL <= 0with 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 <= 0as "immediate deletion" - a natural extension of the existing TTL behavior where smaller values mean faster cleanup.What changes were proposed in this pull request?
Removed the
MaxTTL <= 0validation error inexecutor/setup.go. GC now starts with any MaxTTL value when interval > 0.Added immediate-deletion logic in
executor/pkg/controller/garbage_collector.go. WhenmaxTTL <= 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.Updated config documentation in
executor/pkg/config/config.goto note the<= 0behavior in the pflag help text.MaxTTLvalue> 0<= 0Existing 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 immediatelymaxTTL = -1h: verifies negative values behave the same as zeroRan
go fmt ./...andgo vet ./...locally - both pass clean.This contribution was developed with AI assistance (Claude Code + Codex).
Labels
MaxTTL <= 0.main