Repository navigation
--efa attaches one EFA per network card; Elastic IP for multi-interface launches (#661) - #1206
Merged
Merged
Conversation
Contributor
Author
|
Field notes from the first real use, scttfrdmn/adit G2 (us-west-2, 2026-10-20):
|
This was referenced Oct 20, 2026
scttfrdmn
force-pushed
the
fix/661-multi-card-efa
branch
2 times, most recently
from
October 20, 2026 16:51
1a372b2 to
66f8af0
Compare
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
…i-interface launches (#661) `spawn launch --efa` attached exactly one EFA interface at card 0 / device 0, so multi-network-card instances ran on a fraction of their fabric (c8gn.48xlarge 1 of 2, p5en.48xlarge 1 of 16, p5.48xlarge 1 of 32). - --efa now attaches EfaInfo.MaximumEfaInterfaces interfaces (per-card InterfaceTypes from DescribeInstanceTypes): primary card 0 / device 0 InterfaceType efa; every other EFA card device 0 efa-only, per AWS's "Maximize network bandwidth ... multiple network cards" guide. New --efa-interfaces N (0 = all, 1 = the old single interface, > max refused before anything is created). Resolved in ensureAMIAndPreflight, so the non-MPI path, --mpi and --dry-run all get it. - EC2 auto-assigns no public IP with >1 interface, so Launch waits for running, allocates an Elastic IP tagged spawn:managed / spawn:instance-id / spawn:created / spawn:iam-user and associates it to the primary ENI. On failure the address is released and the instance terminated. - Client.Terminate disassociates and releases that address after TerminateInstances (best-effort, warns). spawn cleanup releases an unassociated spawn-allocated address; user-owned EIPs are still never released (#262). The TTL reaper releases orphans (managed + instance tag, unassociated, instance gone, > 15 min) under the NetResources mode; reaper IAM gains ec2:DescribeAddresses and tag-railed ec2:ReleaseAddress. - Dry run shows the interface layout and the Elastic IP plan. - pkg/aws additions only (api/public-surface.txt regenerated); ValidateInstanceTypeForEFAInRegion and EFANetworkInterface keep their signatures, pipeline orchestrator unchanged.
RunInstances rejects a multi-interface request whose interfaces carry no subnet (seen on a real c8gn.48xlarge launch). Resolve the --az's subnet when --subnet-id is empty; without either, stop before RunInstances.
…lastic IP quota (#661) Field notes from the first real use (adit G2): 1. A Spot reclaim, and every other ending but spawn terminate, left the launch Elastic IP allocated and billing. spored now releases its own address after its self-terminate and 20s before a Spot terminate interruption; the reaper releases the address of an instance it terminates; the orphan sweep releases in report mode too. The spored role gains DescribeAddresses and a ReleaseAddress conditioned on spawn:instance-arn == ${ec2:SourceInstanceARN}, and the instance-id/arn tags join the instance's tag-write deny list. 2. A multi-interface launch now checks the EC2-VPC Elastic IPs quota (L-0263D0A3) before creating anything. Refs #661
scttfrdmn
force-pushed
the
fix/661-multi-card-efa
branch
from
October 20, 2026 19:31
66f8af0 to
86ef5b6
Compare
This was referenced Oct 20, 2026
Merged
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.
Fixes #661.
The change.
spawn launch --efanow attaches every EFA interface the type supports, one per network card.--efa-interfaces Npicks the count: 0 (default) means the maximum and 1 means the old single interface.efa; card i / device 0 isefa-only, per https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/efa-acc-inst-types.html. A type whose card 0 has no EFA gets an ENA primary.Client.Launchallocates one after running and associates it to the primary ENI. It is taggedspawn:managed,spawn:instance-idandspawn:purpose=efa-public-ip. If association fails, the address is released and the instance terminated.spawn terminatereleases the address after TerminateInstances.REAPER_NET_RESOURCES, which defaults toreport.spawn cleanupreleases unassociated spawn-allocated addresses.--az's subnet when--subnet-idis empty.--dry-runshows the layout and the Elastic IP plan.Real-AWS check (2026-10-19, us-east-1a, c8gn.48xlarge spot, scttfrdmn/adit G2 #48):
0/0 efa(Elastic IP associated) and1/0 efa-only./sys/class/infinibandshows rdmap83s0 and rdmap166s0, andfi_info -p efalists both domains. S3 is reachable over the Elastic IP.spawn terminateprinted "Released Elastic IP …". Afterwardsdescribe-addressesbyspawn:instance-idis empty and the instance is terminated.InvalidParameterValue: Each network interface requires either a subnet…, which is fixed in the second commit.Tests:
go build,go vet(darwin, linux and windows) andgo test ./...pass, including the root meta-tests, nested modules and tidy.--efa-interfacesbounds;Not done / for the maintainer (original list; see the takeover notes below for what's now settled):
--efa-interfacesis given.reportmode becomereapfor addresses? Settled: yes, for the launch Elastic IP only (see below).reapSecurityGroupsandreapPlacementGroupsrecord the outer nilerr.Takeover changes (field notes from adit G2)
The branch is rebased onto main at v0.137.0. All the original entries are under
## [Unreleased],make changelog-fixis clean, and the released-sections gate passes.Field note 1: a released or reclaimed instance left its Elastic IP billing
Every way an instance ends now releases the address.
spored:
EC2Provider.Terminatereleases the address after its TerminateInstances. That covers TTL, idle, cost-limit and on-complete.terminatereleases it once, 20s before the interruption time (stopandhibernatekeep it).ReleaseAddresscall per address and never callsDisassociateAddress. The address is the instance's only egress, so once it is disassociated the instance can no longer send the release.ReleaseAddressalso disassociates.InvalidIPAddress.InUse. spored logs it and leaves the address to the reaper.pkg/elasticippackage, which spored and the reaper both import.Launch:
spawn:instance-arn=arn:<partition>:ec2:<region>:<owner>:instance/<id>.ownerId, so no extra call is needed.Instance role (both spored policies, the dynamic baseline and the static shared/DCV one). It gains these two statements:
{"Sid":"DescribeElasticIPs","Effect":"Allow","Action":"ec2:DescribeAddresses","Resource":"*"} {"Sid":"ReleaseOnlyOwnElasticIP","Effect":"Allow","Action":"ec2:ReleaseAddress","Resource":"*", "Condition":{"StringEquals":{"ec2:ResourceTag/spawn:managed":"true", "ec2:ResourceTag/spawn:instance-arn":"${ec2:SourceInstanceARN}"}}}${ec2:SourceInstanceARN}thatTerminateOnlySelfalready uses, which was proven on real AWS in Spot replacement self-retirement (#1008) STOPS the replacement instead of ending it: untagged, request cancelled, EBS bills forever #1080.spawn:managed=trueresource, and that includes these addresses. Sospawn:instance-arnandspawn:instance-idare added toreaperControlTagKeys, the deny list. Otherwise a spore could write its own ARN onto another spore's address and then release it.Reaper:
terminate()releases the address of an instance it has just terminated. It usesReleaseAddressonly, so the reaper role needs noDisassociateAddress. In a nondefault VPC the address is released by the sweep on a later cycle.REAPER_NET_RESOURCES=off.Orphan sweep default (decision):
report, the default, as well as inreap. OnlyoffandREAPER_DRY_RUNhold it back. The security-group and placement-group sweep stays staged (gated).spawn:managed=true,spawn:purpose=efa-public-ip(a new requirement) andspawn:instance-id. Only spawn writes them, and the instance is denied from writing them.Other:
RELEASEDis now anActionSentinel, sospawn reaper teardown --if-idle-forcounts it as activity. The existing sentinel-discovery gate caught this.Field note 2: the Elastic IP quota
ensureAMIAndPreflightchecks the quota for every multi-interface launch and its--dry-run. It counts the region's addresses withDescribeAddressesand reads Service Quotasec2/L-0263D0A3("EC2-VPC Elastic IPs").GetAWSDefaultServiceQuota.--countinstance. When the launch would exceed the quota it fails before anything is created, with "N of M Elastic IPs in use in , and this launch needs K more" and a note that--efa-interfaces 1needs no Elastic IP.Permissions (in the CHANGELOG)
servicequotas:GetServiceQuotaandservicequotas:GetAWSDefaultServiceQuota, both optional (without them the preflight only warns).Gates
Each gate was watched failing against a revert that compiles. I ran 21 reverts and the gates caught all 21:
--countignored;The IAM test evaluates each whole spored policy with a small evaluator (explicit deny wins, and an unmodelled operator fails the test):
spawn:managed, and any request without a SourceInstanceARN.Checks
make checkcheck-build-tags, which fails identically on unmodified main because of the/private/tmppathsmake lintmake check-docssemgrep --config=auto --error// nosemgrepabove one test-fixture write that came in with the original PRmake api-snapshotUnverified (no AWS calls in this takeover)
ReleaseAddresssent from the instance through its own associated Elastic IP in a default VPC takes effect, even if the response is lost.spawn:instance-arn, and instance roles keep their old policy until a launch refreshes it. In both cases the reaper is what releases the address.