Repository navigation
refactor: create ephemeral FSx after RunInstances succeeds (#213) - #215
Merged
Merged
Conversation
Reorders launcher.Provision and the CLI single-instance path so the ephemeral FSx is created AFTER the launch succeeds, not before. A capacity-failed launch (InsufficientInstanceCapacity — the case lagotto retries on) now issues zero CreateFileSystem calls: no orphan AND no create→fail→delete churn that the #210 teardown otherwise incurred on every per-AZ/per-poll retry. - Pre-launch: validateEphemeralFSx enforces the fail-closed lifecycle contract (#193) so a bad config still fails fast without launching an instance. - Post-launch success: createAndAttachEphemeralFSx creates the FSx (co-located with the instance AZ, #208) and tags the running instance spawn:fsx-pending via UpdateInstanceTags, so spored waits → DRA → mounts once AVAILABLE (#194, unchanged). RunInstances returns while the instance is still booting, so the tag lands well before spored reads it; the 5-min config refresh covers lag. - Teardown kept ONLY as a backstop for the narrow create-ok-but-tag-failed window (delete rather than leak). Reaper ephemeral-orphan net (#210) is the outer backstop. - Job arrays (count>1) keep creating the shared FSx up front (each instance is tagged from config at dispatch, so it must exist first). - No user-visible latency change (spored mounts async). Tests: TestValidateEphemeralFSx (fail-fast pre-launch validation); existing fail-closed + end-to-end launcher tests still pass. Closes #213
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 #213. The structural follow-up to #210 — removes the create/teardown churn rather than just making it safe.
Change
Reorders the ephemeral
--fsx-createflow so the filesystem is created afterRunInstancessucceeds:Before (#210 era): create FSx → RunInstances → on failure, delete FSx. Under lagotto's per-AZ/per-poll capacity-retry loop, that's a create→fail→delete cycle on every attempt.
After: RunInstances → on failure, return (nothing created) → on success, create FSx + tag instance
spawn:fsx-pending. A capacity-failed launch issues zeroCreateFileSystemcalls by construction.How it preserves every existing guarantee
validateEphemeralFSxruns before launch, so a bad lifecycle / missing bucket still errors without billing an instance.spawn:fsx-pending(+ mount point, S3 import/export) viaUpdateInstanceTags; spored waits → DRA → mounts once AVAILABLE (FSx ephemeral path: async-create + spored wait-and-mount (instance-owned, lagotto-safe) #194).RunInstancesreturns while the instance is still booting (tens of seconds before spored starts), so the tag lands well before spored reads it; spored's 5-min config refresh covers any eventual-consistency lag.--count > 1) keep creating the shared FSx up front — each instance is tagged fromconfig.FSxPendingat dispatch, so the filesystem must exist first. (The reaper net covers an array-dispatch failure.)Scope
Both the CLI single-instance path (
cmd/launch.go) and the headless launcher (pkg/launcher/provision.go, the lagotto path).Tests
TestValidateEphemeralFSx(fail-fast pre-launch validation, valid + 4 reject cases). ExistingTestProvision_FSxLifecycleFailClosedandTestProvision_EndToEndstill pass.go vet ./...,cmd/launcher/awssuites green, gofmt clean.Verifies
lagotto#45 (a multi-AZ capacity-fail poll now creates zero filesystems). Refs #210 (orphan fix this supersedes as the normal path), #208, #194.