feat: idle Knative Service cleanup based on last-scaled activity - #26
Open
williamsena-vtex wants to merge 10 commits into
Open
feat: idle Knative Service cleanup based on last-scaled activity#26williamsena-vtex wants to merge 10 commits into
williamsena-vtex wants to merge 10 commits into
Conversation
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
🛡️ SDD Check — action requiredI couldn't detect an SDD in this PR. Please check one option below (requires write access to the repo):
|
A cluster runs cleanup by either ConditionalTTL's creation-timestamp TTL or Knative idle detection, never both at once. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
williamsena-vtex
requested review from
AdrianWR,
FelipeNascimento,
GeraldoSJr,
denishelena and
mariovtex
September 4, 2026 20:43
Both are local working docs for the brainstorming/writing-plans workflow, not artifacts meant to live in the repo history. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
IDLE_KNATIVE_CLEANUP_ENABLED only turns the idle-cleanup controller on or off; ConditionalTTL's creation-timestamp TTL cleanup always runs, same as before this feature was added. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Without these, the generated Helm chart had no way to set IDLE_KNATIVE_CLEANUP_ENABLED/_THRESHOLD at install/upgrade time - required to actually turn the feature on in a cluster. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
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.



Summary
IdleKnativeCleanupReconcilerthat deletes Knative Services declaringautoscaling.knative.dev/min-scale: "0"once all their Deployments have stayed at 0 replicas past a configurable threshold, tracked via a controller-ownedcleaner.vtex.io/idle-sinceannotation (no reliable native "last replicas changed" field exists on Deployment or Knative objects — see design doc).IDLE_KNATIVE_CLEANUP_ENABLED(defaultfalse) andIDLE_KNATIVE_CLEANUP_THRESHOLD(default12h).cleaner.vtex.io/exclude: "true"annotation on the Service.ConditionalTTLCRD/CEL machinery — no changes toapi/v1alpha1/orcustom_cel/.Design & Plan
docs/superpowers/specs/2026-09-01-idle-knative-cleanup-design.md(local, gitignored)docs/superpowers/plans/2026-09-01-idle-knative-cleanup.md(local, gitignored)Test plan
controllers/idle_knative_cleanup_helpers_test.go— table-driven unit tests for candidate-detection helpers (no envtest)controllers/idle_knative_cleanup_controller_test.go— envtest/Ginkgo coverage: marks idle-since, deletes past threshold, resets on reactivation, respects exclude annotation, ignores non-candidatesmake fmt vet testpasses (full suite, including pre-existingConditionalTTLsuite — no regressions, coverage 73.2% → 77.3%)make manifestsregeneratedconfig/rbac/role.yamlwith the newserving.knative.dev/servicesandapps/deploymentsrules🤖 Generated with Claude Code