api: add opt-in instance retention pruner - #1603
Open
mohammedadnan21 wants to merge 2 commits into
Open
Conversation
Dead machines stay in instance and related tables forever, which is the growth operators hit when Kubernetes nodes churn. Keep the job off by default, add a dry-run, and delete in batches so upgrades do not change behaviour. Signed-off-by: Mohammed Adnan <muhammedadnan50007@gmail.com>
A first enable against years of dead nodes must not drain the table in one pass. Cap batches, re-check freshness at delete time, and keep hourly logs quiet when nothing was removed. Signed-off-by: Mohammed Adnan <muhammedadnan50007@gmail.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
last_check_for_updates(orcreated_tsif they never checked in) is older than-instance-retention. Default remains0(disabled), so existing deployments do not change on upgrade.-instance-retention-dry-run) logs the would-delete count without removing rows. Live deletes run in batches; relatedinstance_application,instance_status_history,event, andactivityrows go withON DELETE CASCADE.nebraska_instances_pruned_totalfor actual deletes. Operator notes are indocs/instance-retention.md.Fixes #1585. Operators with node churn described the same gap in #352.
How to use
Retention stays off unless an operator sets a duration:
2160his 90 days. Dry-run only logscandidates. Remove-instance-retention-dry-runto delete. Helm can pass the same flags viaextraArgs.Testing done
Against Postgres 17:
Those tests passed: stale vs fresh, dry-run, multi-app keep, batched deletes, cascade of status history, orphan
created_tsprune, and config validation.