Skip to content

feat(spored): mount async-created FSx at runtime (#194 part 1) - #198

Merged
scttfrdmn merged 1 commit into
mainfrom
feat/194-spored-fsx-mount
Jun 16, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
feat/194-spored-fsx-mount

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Part 1 of #194 — the agent half (the genuinely new capability). Part 2 (launch fires async CreateFileSystem + tags spawn:fsx-pending) follows; lagotto#43 unblocks after both.

What

spored gains its first runtime mount capability. Today FSx is mounted only by first-boot user-data, which can't wait for a still-CREATING filesystem. So for the ephemeral path (FSx created async alongside the instance), spored:

  1. reads spawn:fsx-pending=<fs-id> + spawn:fsx-mount-point from tags;
  2. polls DescribeFileSystems until AVAILABLE (bounded 25 min);
  3. mounts it (mount -t lustre, Linux) + fstab line, idempotently;
  4. flips the tag to spawn:fsx-id so the reaper refcount (ttl-reaper must reclaim orphaned FSx Lustre filesystems (cost backstop; prerequisite for any FSx auto-create) #192) counts this instance as a live user of the filesystem.

Safety (the #65 discipline)

The poll can block for ~10 min, so mountPendingFSx runs in its own goroutine off the lifecycle ticker — exactly like spot monitoring. It must never gate TTL/idle/on-complete/pre-stop. Best-effort throughout: a failed or slow mount logs + notifies (fsx_mount_failed) but never terminates the instance. Idempotent on a spored restart (skips if already mounted).

Mechanics

  • pkg/provider: Config.FSxPending/FSxMountPoint; loadConfigFromEC2Tags maps the two tags (single authoritative mapping, used by both GetConfig and RefreshConfig).
  • pkg/agent/fsx_mount.go: orchestration; sysMountLustre real on Linux (sys_linux.go), no-op error on windows/other.
  • Monitor starts go a.mountPendingFSx(ctx) beside the spot goroutine.

Tests

mountPendingFSx returns promptly when nothing is pending (the common case — guards against an accidental AWS call/hang); shellQuoteArg escaping (Linux). Builds linux/darwin/windows; go vet/gofmt clean.

The poll-and-mount-against-real-FSx path can't be exercised against substrate (FSx fidelity gaps, see substrate#331) — it'll want a live FSx validation before the feature is announced. The no-op + escaping + cross-platform compile are covered here.

Refs #194.

The agent half of the ephemeral-FSx path. spored gains its first runtime mount
capability: when an instance carries spawn:fsx-pending=<fs-id> (set by the launch
side, part 2), spored polls DescribeFileSystems until the filesystem is
AVAILABLE, mounts it (Lustre, Linux), and flips the tag to spawn:fsx-id so the
reaper refcount (#192) counts the instance as a live user.

- pkg/provider: Config.FSxPending / FSxMountPoint; ec2.go maps spawn:fsx-pending
  + spawn:fsx-mount-point in loadConfigFromEC2Tags.
- pkg/agent: mountPendingFSx goroutine started from Monitor OFF the lifecycle
  critical path (same #65 discipline as spot monitoring — a ~10min poll must
  never gate TTL/idle/on-complete/pre-stop). Bounded 25m wait; best-effort, never
  terminates over a failed mount; idempotent (skips if already mounted).
- sysMountLustre: real mount on Linux (install client, modprobe, mount -t lustre,
  fstab); no-op error on windows/other.

Tests: mountPendingFSx no-ops promptly when nothing pending; shellQuoteArg
escaping (linux). builds linux/darwin/windows; vet/fmt clean.

Refs #194
@codecov

codecov Bot commented Jun 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 10.61947% with 101 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/agent/fsx_mount.go 5.81% 81 Missing ⚠️
pkg/agent/sys_linux.go 11.11% 16 Missing ⚠️
pkg/provider/ec2.go 0.00% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit 1540837 into main Jun 16, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant