Repository navigation
fix: spored reliably mounts async ephemeral FSx (#221) - #253
Merged
Merged
Conversation
Two independent bugs each made the async FSx mount (#194) silently never fire — no log lines, empty mount point, workload hanging (hit on the BuckAI/fieldwork SAM beta): 1. Startup race. mountPendingFSx ran exactly once at monitor start, reading spawn:fsx-pending immediately. The launch path tags the instance AFTER RunInstances (FSx create + EnsureLustrePorts take seconds) and EC2 tags are eventually consistent, so the tag was frequently absent at that single read. The periodic RefreshConfig later populated FSxPending, but nothing re-invoked the mount → silent no-op (the FSxPending=="" early return logs nothing). Now driven from the monitor loop (maybeMountPendingFSx in checkAndAct, after the config refresh), idempotent via fsxMountStarted, so a tag landing after boot is picked up and mounted once. 2. Missing IAM. The spored inline policy had NO fsx:* perms, so even with the tag present the mount failed AccessDenied on fsx:DescribeFileSystems / fsx:CreateDataRepositoryAssociation. buildInlinePolicy now grants those (+ DescribeDataRepositoryAssociations); re-applied on every launch via updateInlinePolicy, covering both CLI and lagotto/headless paths. Tests: maybeMountPendingFSx gating+idempotency; spored FSx-mount IAM grant; updated buildInlinePolicy statement counts (4->5). make check green. Fixes #221.
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
Closes #221. On a lagotto-launched instance with ephemeral
--fsx-create, the FSx reached AVAILABLE but spored never mounted it — empty/fsx, workload hanging, and tellingly no spored log lines at all. Root-caused to two independent bugs, either of which alone produces the silent no-op:1. Startup race (primary)
mountPendingFSxran exactly once at monitor start (agent.go), readingspawn:fsx-pendingimmediately. But the launch path writes that tag afterRunInstances(the FSx create +EnsureLustrePortsadd seconds), and EC2 tags are eventually consistent — so the tag was frequently absent at that single read. The periodicRefreshConfiglater populatedFSxPending, but nothing re-invoked the mount, and theFSxPending == ""early return logs nothing → exactly the "no log lines" symptom.Fix: drive the mount from the monitor loop (
maybeMountPendingFSxincheckAndAct, after each config refresh), idempotent viafsxMountStarted. A tag that lands after spored boots is now picked up and mounted once.2. Missing IAM (also fatal)
The spored inline policy had no
fsx:*permissions, so even with the tag present the mount would fail AccessDenied onfsx:DescribeFileSystems/fsx:CreateDataRepositoryAssociation. (Same class as the #212 reaper-FSx-perms gap.)Fix:
buildInlinePolicynow grantsfsx:DescribeFileSystems,fsx:CreateDataRepositoryAssociation,fsx:DescribeDataRepositoryAssociations. Re-applied on every launch viaupdateInlinePolicy, so both CLI and lagotto/headless instances get it on next launch (no manual IAM migration for the role).Tests
TestMaybeMountPendingFSx_GatingAndIdempotency— no-pending → not started (re-checks later); pending → started exactly once.TestSporedFSxMountGrant— the FSx APIs are in the spored policy.TestBuildInlinePolicystatement counts (4 → 5).make checkgreen.Note
The IAM grant reaches an instance's role on its next launch (the inline policy is re-applied at launch). Already-running agentless instances from before this fix are unaffected; relaunch to pick it up.