Repository navigation
doctor: detect real reaper coverage instead of always warning; warn at launch when it matters - #631
Merged
Merged
Conversation
…arn at launch when it matters spawn doctor's 'TTL reaper backstop' check was a hardcoded 'not detected' — ReaperConfigured returned the same error unconditionally, on the reasoning that a launch account cannot see a reaper living elsewhere. The effect was a check that printed an identical warning in EVERY account, including accounts the reaper does cover. It carried no information, and a warning that always fires is one users learn to scroll past: an account where nothing reclaims expired instances read exactly like a healthy one. That is how a spawn:managed instance sat stopped for 13 days past its TTL, still billing EBS, while doctor said what it says everywhere. Coverage does leave local evidence, in two shapes: a reaper Lambda running in this account (REAPER_SCAN_SELF), or the conventional spawn-ttl-reaper-ec2 role, which nothing but that setup creates. Verified against three real accounts before writing the code — the infra account matches the first, a spore-launching account the second, and the account with the 13-day orphan matches neither. 'Could not determine' is now distinct from 'there is none', and doctor no longer prepends 'no out-of-band reaper configured' to a verdict that only said it could not tell. A Pass names its evidence so an operator can tell the two coverage shapes apart. Launch-side: a launch that DEPENDS on the reaper warns when no reaper covers the account, before anything is spent and including under --dry-run/--estimate-only. Only two cases qualify — --on-complete stop/hibernate, where EBS keeps billing and spored cannot act once the instance is stopped, and --fsx-lifecycle ephemeral, where only the reaper ever deletes the filesystem. A plain --on-complete terminate does not warn: spored handles it from inside and the reaper is only a backstop, so warning there would recreate exactly the noise this removes. Refs #624
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.
Refs #624.
The check was a constant
spawn doctor's "TTL reaper backstop" was a hardcodedreturn "", fmt.Errorf("not detected from this account …")— the same warning in every account, covered or not, on the reasoning that a launch account can't see a reaper living elsewhere.So it carried no information. And a warning that always fires is one people learn to scroll past: an account where nothing reclaims expired instances read exactly like a healthy one. That is how a
spawn:managedinstance sat stopped for 13 days past its TTL, still billing EBS, whiledoctorsaid what it says everywhere.Coverage does leave local evidence
Two shapes, and nothing else creates either:
REAPER_SCAN_SELF) —spawn-ttl-reaper-*spawn-ttl-reaper-ec2role, which exists only because an operator granted a reaper elsewhere accessVerified against three real accounts before writing the code:
spawn-ttl-reaper-productionAnd the shipped check, run against each:
"Could not determine" is now distinct from "there is none." If a probe can't complete (no
lambda:ListFunctions, noiam:GetRole), the check says so rather than asserting an absence it can't prove — anddoctorno longer prepends "no out-of-band reaper configured" to that verdict. A Pass names its evidence, so an operator can tell the two coverage shapes apart.Launch-side warning, only where it changes the outcome
Before anything is spent, and including under
--dry-run/--estimate-only— those are the "what would this cost me" surfaces, and a reaper that won't reclaim an ephemeral filesystem is exactly such a cost.Two cases qualify:
--on-complete stop/hibernate— the instance stops,sporedruns inside it and can no longer act, EBS and any EIP keep billing. This is the precise shape of the 13-day orphan.--fsx-lifecycle ephemeral— the filesystem outlives its instance by design, so the reaper is the only thing that deletes it (--fsx-lifecycle ephemeral did not reap the filesystem when the instance terminated (1.2 TiB left AVAILABLE and billing) #613). A 1200 GiB minimum, ~$174/month.A plain
--on-complete terminatedoes not warn.sporedhandles it from inside and the reaper is only its backstop; warning there would recreate exactly the noise this change removes. Verified on real accounts:--on-complete stop--fsx-lifecycle ephemeral--on-complete terminate--on-complete stopTests
pkg/aws/reapercoverage_test.go— the three states stay distinguishable (the core of #624); advice fires for stop/hibernate/ephemeral-FSx and is silent for terminate, no flags, durable FSx, and any covered account; the warning names the cost (EBS, 1200 GiB, $174) rather than describing the architecture; both flags together report both consequences; and an undetermined verdict hedges ("Could not confirm") instead of asserting absence.pkg/doctor/doctor_test.go—doctormust not prepend an unproven claim, and a Pass must carry its evidence. Verified to fail against the old hardcoded wording.Gates
gofmt·go vet ./...·go build ./...·go test ./...all green ·make check-docsclean ·go mod tidyclean ·staticcheckzero added (diffed by message).Note
This closes the visibility half of the reaper gap. #625 — a supported way to run a reaper in your own account, which governed orgs need because the cross-account grant is forbidden there — is still open and is the half that makes an uncovered account fixable rather than merely knowable.
Suggested bump: MINOR (doctor's verdict changes meaningfully, and there's a new launch-time warning).