Repository navigation
Conversation
This was referenced Oct 15, 2026
Burst's boot script never installed spored: it waited up to 300s for /usr/local/bin/spored and exited, so spored only ran on an AMI that already had it. Burst members now boot with launcher.BuildLinuxBootstrap, the same bootstrap spawn launch uses, which downloads spored for the instance's architecture, verifies it (pkg/sporedinstall, fail closed) and starts it. Members record ec2-user as spawn:local-username, the user it configures. Without --ami, burst took the newest self-owned spawn-* image of any architecture or OS. pkg/aws Client.GetSelfOwnedSpawnAMI now only returns one matching the instance type's architecture, Linux, and GPU-ness where tagged; otherwise burst falls back to GetRecommendedAMI, as spawn launch does. A Windows --ami is refused before the registry table or IAM role is touched. cmd/burst.go no longer imports the EC2 SDK. The shared bootstrap truncated authorized_keys when given no public key, which erased the key cloud-init installs from an EC2 key pair. It now leaves the file alone in that case, so burst --key-name (and Provision callers with KeyName) can still log in. Fixes #924.
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.
Stacked on #934 (
fix/918), which is stacked on #926 (fix/905). Only the #924 change is in this diff.Problem
generateBurstUserDatawaited up to 300s for/usr/local/bin/spored, then exited 1. spored only ran on an AMI that already had it. Without spored a member has no idle termination, no on-complete, no hybrid-registry registration and no DNS. After Give spawn burst instances credentials, tags and a TTL (#905) #926 the TTL reaper still bounds the instance through its deadline, but in-instance enforcement (launch should fail if spored fails to install on the instance #50) is missing.findLatestSpawnAMItook the newest self-ownedspawn-*image of any architecture or OS. An arm64 or Windows image could land on an x86 Linux type.Fix
Shared bootstrap. Burst user-data is now
launcher.BuildLinuxBootstrap, the bootstrapspawn launchandlauncher.Provisionuse. It:spawn-binaries-<region>for the instance's architecture;pkg/sporedinstall(sha256 plus signature, fail closed, aborting the boot rather than running an unverified agent);Nothing burst-specific is appended. spored registers the member with the hybrid registry from its
spawn:burstandspawn:job-array-*tags. Members setLaunchConfig.Username = ec2-user(spawn:local-username), the user the bootstrap configures, asProvisiondoes.AMI selection. There is a new exported
pkg/awsClient.GetSelfOwnedSpawnAMI(ctx, region, instanceType). It returns the newest available self-ownedspawn-*AMI that:Image.ArchitectureagainstresolveArchitecture, the resolverGetRecommendedAMIuses);Platformis not windows, andspawn:os, if present, is linux);spawn:gpu=true, because nothing else says the image has a driver. A CPU type skipsspawn:gpu=trueimages.It returns
""if none fits.resolveBurstAMIfalls back toGetRecommendedAMI, the AL2023 resolutionspawn launchuses, when no image fits or when the self-owned lookup fails.""andautoboth mean auto-detect, as forspawn launch. Whether spored is baked into the image no longer matters, because the bootstrap installs it.Windows
--amiis refused. The bootstrap is Linux-only. The AMI is now resolved beforeregistry.EnsureTableand the IAM setup, so a refusal creates nothing.cmd/burst.gono longer imports the EC2 SDK.TestNoNewAWSSDKImportsInCmd's allowlist is tightened accordingly.Found while doing this: the bootstrap erased the EC2 key pair's key
BuildLinuxBootstrapwith noPublicKeywrote an emptyauthorized_keysfor its user. cloud-init installs theKeyNamekey pair's key into the default user'sauthorized_keysbefore user-data runs. So withec2-userand no public key, the bootstrap erased the key the user had asked for. Moving burst to the bootstrap would have brokenspawn burst --key-name. The old script never touchedauthorized_keys. The same applies to anylauncher.Provisioncaller that setsKeyName. The bootstrap now writes the file only when it has a key, and otherwise justtouches it.spawn launch, which always passes a key, still replaces the file.Public surface
This adds
func (*Client) GetSelfOwnedSpawnAMI(ctx context.Context, region, instanceType string) (string, error)topkg/aws. It is an addition, not a removal.api/public-surface.txtwas regenerated withmake api-snapshot, anddocs-gen/burst.mdwithmake gen-docs.Tests
cmd/burst_spored_test.goTestBurstMembersInstallAndVerifySporedchecks the decoded member user-data. It must:sporedinstall.VerifiedInstallFunc();spore_install_verified_spored "$BINARY", matched at line start (rule 3);exit 1;systemctl start sporedafter the install;TestBurstUserDataIsValidBashrunsbash -non the script.TestBurstMembersRecordTheBootstrapUserTestResolveBurstAMIuses a fake resolver to cover: an explicit Linux AMI, a Windows refusal, a fitting self-owned AMI preferred,auto, the fallback when nothing fits, the fallback on a lookup error, and no AMI at all. A compile-time assertion pins*aws.Clientas the resolver.pkg/aws/ami_spawn_test.goTestPickSpawnAMItests the selector directly (rule 2): architecture, Windows byPlatformand byspawn:os, and GPU in both directions.TestGetSelfOwnedSpawnAMIMatchesTheInstanceTyperuns the realDescribeImagespath on Substrate. t3.micro gets the x86 image and t4g.micro gets the arm64 one.pkg/launcher/bootstrap_authorized_keys_test.goextracts the generatedauthorized_keysstep and runs it under bash against a temp home. With no key, an existing key pair's key is kept, or an empty file is created if none exists. With a key, the file is replaced.Each test was watched failing against a revert that compiles, with
go vetclean on each reverted tree:buildBurstUserDatareturns the old bounded-wait script (_ = script)TestBurstMembersInstallAndVerifySporedfalse && …TestResolveBurstAMI/explicit_Windows_AMI_is_refusedcase false && own != ""TestResolveBurstAMI/auto_prefers…,/"auto"_is_auto…return "", errTestResolveBurstAMI/a_failed_self-owned_lookup_falls_back…false && …TestPickSpawnAMIcases,TestGetSelfOwnedSpawnAMIMatchesTheInstanceTypePlatformwindows check →false && …TestPickSpawnAMI/a_Windows_image_is_never_chosenspawn:oscheck →false && …TestPickSpawnAMI/an_image_tagged_spawn:os=windows…return trueTestPickSpawnAMIcasesUsername: ""TestBurstMembersRecordTheBootstrapUserif true || [ -n "$LOCAL_SSH_KEY_BASE64" ](always overwrite)TestEmptyPublicKeyKeepsTheKeyPairsKeymake checkpasses exceptTestGenerateWrapper_ChownFixesCrossUIDStickyUnlink_Docker, which needs a Docker daemon.make check-nestedreports all 9 nested modules clean. No AWS resources were created and no instances were launched.Caveats
spawn-binaries-<region>(S3), the AWS CLI andec2-metadata, as withspawn launch. That means an Amazon Linux 2023 image. A self-ownedspawn-*image built on another distro passes the architecture and OS checks but may not run the bootstrap.--amiis not checked for architecture. RunInstances rejects a mismatch itself.IsWindowsAMItreats a failed DescribeImages as "not Windows", as it does forspawn launch.--key-namecan log in asec2-user. The fix follows from cloud-init's documented module order (thesshmodule runs in the init stage, beforescripts-userin final). It has not been observed on an instance.Filed separately
spawn burstignores--region,--profileandSPORE_REGION. It andregistry.EnsureTableuse a bareconfig.LoadDefaultConfig.Fixes #924