Repository navigation
fix: ttl-reaper deletes DNS on reap (#247) + deploy-script build (#248) - #249
Merged
Merged
Conversation
#247 — the reaper now tears down a reaped instance's Route53 records itself. spored's graceful shutdown deletes its DNS record, but the reaper only fires when spored FAILED (dead/wedged/never-ran), so reaped instances leaked their A-records (and the #121 friendly-name alias CNAME) into the zone forever — the root cause of the orphaned records observed in spore.host. Per the backstop principle, the reaper does NOT wake the dead daemon to clean up; it performs the teardown out-of-band: - captures spawn:dns-name / spawn:account-base36 / spawn:account-name in evaluate() - deletes {dns-name}.{account-base36}.{domain} (canonical A) and, when present, {dns-name}.{account-name}.{domain} (the #121 alias CNAME) - uses the reaper's OWN (infra-account) Route53 creds — the zone lives there, not in the per-instance cross-account role - best-effort + REAPER_DRY_RUN-aware; runs AFTER terminate so it can never block the hard-deadline guarantee (#72) - enabled via REAPER_DNS_ZONE_ID + REAPER_DNS_DOMAIN (both empty = off, no route53 IAM attached); template.yaml gains scoped route53:ChangeResourceRecordSets/ListResourceRecordSets + a DnsTeardownEnabled condition. Mirrors the reaper's existing FSx-cleanup ownership (#192/#212). #248 — scripts/deploy-custom-dns.sh built the Lambda with `go build main.go`, which misses signature.go (undefined: verifyInstanceIdentitySignature). Fixed to `go build .`. Tests: dnsRecordsToDelete (pure: A-only / A+alias / no-dns / missing-base36 / empty-domain) + evaluate() populates the DNS fields. cfn-lint clean. Fixes #247, #248.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 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.
Summary
Two fixes. The substantive one (#247) makes the ttl-reaper clean up DNS, eliminating the record leak behind the 61 orphans in
spore.host. The other (#248) is a one-line deploy-script build fix.#247 — reaper deletes DNS on reap (manual, out-of-band)
spored's graceful shutdown deletes its DNS record, but the reaper is a backstop that only fires when spored failed — so reaped instances were leaking their
Arecords (and the #121 friendly-name aliasCNAME) into the zone indefinitely.Per the design principle (a dead daemon can't clean up after itself), the reaper does the teardown itself, out-of-band — it does not wake spored:
evaluate()capturesspawn:dns-name/spawn:account-base36/spawn:account-name.{dns-name}.{account-base36}.{domain}and, when the instance carried the Use the AWS account's friendly name (not just base36 account ID) in DNS and elsewhere #121 alias, the{dns-name}.{account-name}.{domain}CNAME.REAPER_DRY_RUN-aware, and runs after the terminate so it can never block the hard-deadline guarantee (Guardrail: TTL must always terminate — never add a TTL→stop mode #72).REAPER_DNS_ZONE_ID+REAPER_DNS_DOMAIN(both empty = off → noroute53IAM attached).template.yamlgains the scopedroute53:ChangeResourceRecordSets/ListResourceRecordSetsbehind aDnsTeardownEnabledcondition.This mirrors the reaper's existing ownership of FSx cleanup (#192/#212).
Note on the friendly-name alias
Confirmed the #121 capability is an alias, not a replacement: the base36
A-record stays authoritative and{record}.{account-name}.{domain}is an addedCNAME. So the reaper deletes both whenspawn:account-nameis set.#248 — deploy-custom-dns.sh build
go build main.go→go build .(the handler is split acrossmain.go+signature.go, so the single-file build failed withundefined: verifyInstanceIdentitySignature).Tests
TestDNSRecordsToDelete(pure record construction: A-only / A+alias / no-dns / missing-base36 / empty-domain) andTestEvaluate_PopulatesDNSFields.cfn-lint template.yamlclean;go test ./...green.Follow-up (not in this PR)
Sweeping the ~61 existing orphans is a one-off cleanup — call it separately (this PR stops new ones).