Repository navigation
fix(mpi,efa): mint the MPI cluster key per instance (#1338); --efa-group shared EFA security group (#1168) - #1345
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
…ed EFA security group (#1338, #1168) missing and every authorized_keys write appended, so a cohort launched from an image of rank 0 reused the parent's private key and kept authorizing the parent's public key. Rank 0 now mints a key unless an owner file names this instance; cluster keys carry the spawn-mpi-cohort comment and installs replace tagged lines; the control plane reads the key only once this instance minted it; the ssh config block is written once. group's all-traffic self rules, added to the launch's other groups. Tagged spawn:managed + spawn:created, so the TTL reaper's managed network sweep deletes it once unused. Fixes #1338 Fixes #1168
scttfrdmn
force-pushed
the
fix/1338-1168-mpi-efa
branch
from
October 27, 2026 00:42
d77eb92 to
32864b5
Compare
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.
Two MPI/EFA launch-setup fixes.
Fixes #1338
Fixes #1168
#1338: a cohort launched from an image of rank 0 reused the parent's root SSH key
pkg/userdata/mpi.goused to runssh-keygenonly when/root/.ssh/id_rsawas missing. Now it regenerates unless/root/.ssh/spawn-mpi-key-ownernames this instance ($INSTANCE_IDfrom the bootstrap, with an IMDS fallback). That uses the same once-per-instance-id idea ascommand-ran-$INSTANCE_ID(ami create from a --command instance: SPAWN_* files written after the command get baked in, and the CreateImage reboot re-runs the command #1057). PR fix: tree-walk test flake (#1334); discard per-instance state inherited from an image (#1241) #1339'spkg/instancestateis not on main yet. It works by path and mtime, so it would throw away the whole ofauthorized_keys, which ami create: an image of an MPI rank-0 instance carries the cohort's root SSH key, which a child cohort reuses #1338 itself says does not fit. The owner file sits in/root/.sshnext to the key, outside the ami create: per-instance spored/plugin state (plugins.json, job-array env, peer files) is still baked into images #1241 state roots, so fix: tree-walk test flake (#1334); discard per-instance state inherited from an image (#1241) #1339's path-discovery gate should not flag it.spawn-mpi-cohort. The rank-0 self-authorize andinstallPubKeyCommand(pkg/mpicohort) each delete the lines ending in that comment and then add the new key. Other lines are kept byte for byte. If grep fails for any reason other than "no lines left", the file is not rewritten.id_rsa.pubit is replacing.ssh-keygen.readRankZeroPubKeycould then read and hand out the inherited key. The read now requires the owner file to name that instance; the ID is validated against^i-[0-9a-f]+$before it goes into the command. The key must also end with the spawn comment.# spawn-mpimarker line guards it, instead of the block being appended on every run./root/.ssh/id_rsaalready on a custom image is now replaced on rank 0. Before, it was adopted as the cluster key and authorized on every member.--efa,--mpi-command, gzip -9): 7149 → 7680 bytes raw, 3153 → 3345 gz (+192). The bare bootstrap is unchanged at 8001 gz.#1168:
--efa-group NAMEfor EFA without--mpi--efa-group NAME(requires--efa) creates or joinsspawn-efa-NAME, using the same create-or-get andensureMPIClusterRulespath as the MPI group. The shared helper iscreateOrGetClusterGroup, which keeps the Nothing reaps managed MPI security groups or placement groups (19 + 9 orphans found); --mpi creates an SG before validating its own flags #685 bare-prefix guard. An existing group gets its rules backfilled.--security-group-idsstay). It opens no SSH, so outside reachability is the same as a plain launch on the VPC default group.lambda/ttl-reaper/netresources.goreapSecurityGroups). It selects ontag:spawn:managed=trueand ages groups byspawn:created; the group gets both fromLifecycleTags. No reaper code change was needed. A new test checks that the sweep's filter matches the group's tags, that it deletes the group once unused past the 7-day grace, and that it spares the group while it is in use or within the grace.--efa-groupchoose a shared subnet/AZ). The help text tells users to launch in one AZ.Gates, each watched failing against a revert that compiles (
go vetclean)ensureEFAGroupcall removed fromensureSecurityGroup--efa-groupaccepted without--efa/root/.ssh(they skip on Windows or when there is no bash/ssh-keygen).CreateSecurityGroupinput through SDK middleware, because substrate keeps no security-group tags and ignorestag:filters (ec2: security groups keep no tags (CreateSecurityGroup TagSpecifications, CreateTags) and DescribeSecurityGroups ignores tag: filters scttfrdmn/substrate#1440).TestSSMAssembler_InstallsClusterKeyBeforePeerschecked for the substringgrep -qxF, which the new reader command also contains, so it would pass however the install behaved. It is replaced by the exec test. The fake rank-0 key now carries the spawn comment.Not verified on AWS: no image of a rank-0 instance has been launched.