Skip to content

feat(dns): tag instances with the account's friendly name (#121) - #134

Merged
scttfrdmn merged 1 commit into
mainfrom
feat/121-account-name-dns
Jun 13, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
feat/121-account-name-dns

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Adds a spawn:account-name instance tag — a DNS-safe slug of the AWS account's friendly name (set via aws account put-account-name) — so DNS can surface a legible {name}.{account-name}.spore.host instead of the opaque {name}.{base36}.spore.host.

How

  • GetAccountName calls account.GetAccountInformation on the caller's creds (the user running spawn launch, not the spored role). Best-effort: returns "" on any error (unset name, no account:GetAccountInformation permission, API down).
  • slugifyDNSLabel produces an RFC-1035 label (lowercase, [a-z0-9-], runs collapse to one hyphen, trimmed, ≤63 chars) or "" if it can't.
  • buildTags writes spawn:account-name only when the slug is non-empty. spawn:account-base36 stays — always present, canonical — so existing FQDNs never break and the name is purely an alias.

Degradation / permissions

No spored-policy change needed (the daemon doesn't call this). A caller lacking account:GetAccountInformation just gets base36, silently — no launch failure.

Tests

  • slugifyDNSLabel: snake/space/punct/junk/empty/leading-trailing-hyphen + 63-char cap.
  • buildTags: tag present with a slug, absent without; base36 always present.
  • Verified live: dev account "Mycelium Development" → mycelium-development.

Follow-up

The DNS-updater/Route53 + spore-bot side that consumes this tag to register the friendly FQDN is spore-host/spore-host#357.

Closes #121.

Add spawn:account-name — a DNS-safe slug of the AWS account's friendly name
(aws account put-account-name), resolved best-effort at launch via
account.GetAccountInformation on the caller's creds. Lets DNS surface a legible
{name}.{account-name}.spore.host instead of the opaque base36 segment. base36
stays as the canonical/always-present fallback, so nothing breaks when the
account has no name or the caller lacks account:GetAccountInformation (returns
"" → tag omitted).

- GetAccountName + slugifyDNSLabel (RFC-1035 label: lowercase, [a-z0-9-],
  collapse runs, trim hyphens, <=63 chars) in pkg/aws/client.go.
- buildTags takes the slug and writes the tag when non-empty.
- Unit tests for slugify (incl. junk/empty/max-length) and the tag presence;
  verified live (dev account "Mycelium Development" -> mycelium-development).

The DNS-updater/Route53 + spore-bot side that consumes the tag is #357.
@codecov

codecov Bot commented Jun 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 9 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/aws/client.go 75.00% 9 Missing ⚠️

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit bb0a623 into main Jun 13, 2026
3 checks passed
@scttfrdmn
scttfrdmn deleted the feat/121-account-name-dns branch June 13, 2026 01:25
scttfrdmn added a commit that referenced this pull request Aug 10, 2026
truffle v0.49.0 (carrying #133 QuotaInfo.SpotUsage and #134
Capabilities.VCPUs) is now released, so this PR no longer needs the
local-path replace directive. go.mod now pins the real tag; verified
the full build/test suite (including TestCatalogValid and the new
sweep-quota tests) against it, not the local checkout.
scttfrdmn added a commit that referenced this pull request Aug 10, 2026
…al quota (#493)

* feat(launch): --max-concurrent-auto derives sweep concurrency from real quota

The sweep orchestrator's wave mechanism (pkg/sweep +
lambda/sweep-orchestrator) already polls active-instance count and
launches min(available, remaining) -- a real batch/wait-for-room
primitive. But its ceiling (state.MaxConcurrent) was always a number
the caller had to already know, via --max-concurrent or the arbitrary
default-10 fallback when a sweep auto-enables --detach.

--max-concurrent-auto queries truffle's quota client for headroom
(quota - current usage) per instance family, in the region the sweep
is about to launch in, and converts vCPU headroom to an instance
count via the real per-type vCPU count (truffle#134's new
Capabilities.VCPUs, not a guessed size suffix). A heterogeneous
sweep's derived ceiling is the MINIMUM across every distinct
(instance type, spot/on-demand) combination present in the sweep, so
a scarce family can't be silently outvoted by a roomier one.

Real-world motivation: a 10-shard fleet launch with no concurrency
guardrail hit an account's real ceiling (a G/VT Spot quota of 64
vCPUs, saturated by 8 running g7e.2xlarge instances) with zero prior
warning; the actual launches then failed with
MaxSpotInstanceCountExceeded.

Not yet wired into `spawn resume`'s equivalent override -- tracked as
a follow-up, since resume already has a recorded region and is a
smaller retrofit.

BLOCKED: go.mod carries a TEMPORARY local replace directive for
truffle, since this code depends on truffle#133 (QuotaInfo.SpotUsage)
and truffle#134 (Capabilities.VCPUs), both unreleased. Must be
resolved to a real tag before merge.

Fixes #492.

* chore: drop temporary truffle replace, pin real v0.49.0

truffle v0.49.0 (carrying #133 QuotaInfo.SpotUsage and #134
Capabilities.VCPUs) is now released, so this PR no longer needs the
local-path replace directive. go.mod now pins the real tag; verified
the full build/test suite (including TestCatalogValid and the new
sweep-quota tests) against it, not the local checkout.
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.

Use the AWS account's friendly name (not just base36 account ID) in DNS and elsewhere

1 participant