Repository navigation
feat(ttl-reaper): reclaim orphaned FSx Lustre filesystems (refcount-aware) (#192) - #196
Merged
Merged
Conversation
…ware) (#192) The cost backstop that gates any FSx auto-create feature (lagotto#43, #193/#194). An auto-created FSx (~$150-200/mo) currently has nothing watching it; the reaper was EC2-only. Reaper now scans spawn-managed FSx per account×region and reclaims one only when: - it's past spawn:ttl-deadline (or, lacking one, older than max-age), AND - NO live instance still references it — refcount computed by joining on the spawn:fsx-id tag already written at launch (a single live user blocks the reap; self-heals leaked leases since a gone instance drops from DescribeInstances), AND - it's AVAILABLE (never touch CREATING/DELETING). Deletion omits SkipFinalExport so an attached S3-export DRA flushes remaining data on delete, not dropping it (#184). Honors REAPER_DRY_RUN / REAPER_NOTIFY_URL like instance reaps; FSx counts added to Summary. Also extracts the inline cmd/fsx.go delete into a shared Client.DeleteFSxFilesystem (pkg/aws), used by both `spawn fsx delete` and (for the CLI) the same no-SkipFinalExport semantics. Tests: evaluateFSx (past-deadline / within-deadline / not-managed / max-age fallback / not-available). reaper + pkg/aws + cmd green; vet/fmt clean. Closes #192
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Closes #192 — the cost backstop that gates the FSx auto-create chain (#193 contract → #194 ephemeral path → lagotto#43). The reaper was EC2-only; an auto-created FSx (~$150–200/mo) had nothing watching it.
What it does
The reaper now scans spawn-managed FSx per account×region and reclaims a filesystem only when all hold:
spawn:ttl-deadline, or (lacking one) older than the max-age ceiling, same logic as instances;spawn:fsx-idtag already written at launch for every mount path; a single live user (pending/running/stopping/stopped) blocks the reap. Self-heals leaked leases (a vanished instance simply drops out ofDescribeInstances);CREATING/DELETING.Safety
DeleteFileSystemomitsSkipFinalExport, so an attached S3-export DRA flushes remaining data on delete instead of dropping it.REAPER_DRY_RUN(logs "WOULD reap" + notifies, deletes nothing) andREAPER_NOTIFY_URL, mirroring instance reaps. NewFSx*counters onSummary.fsx:DescribeFileSystems+fsx:DeleteFileSystem.Refactor
Inline
DeleteFileSystemincmd/fsx.go→ sharedClient.DeleteFSxFilesystem(pkg/aws/fsx.go), sospawn fsx deleteand the no-SkipFinalExportsemantics live in one place.Tests
evaluateFSx: past-deadline reaped, within-deadline spared, non-spawn-managed ignored, max-age fallback, CREATING skipped. reaper +pkg/aws+cmdgreen;go vet/gofmtclean.Unblocks #193 / #194 / lagotto#43.