Skip to content

No way to skip DNS registration on a launch, and dns.enabled is parsed but never read #549

Closed

Description

@scttfrdmn

There is no way to turn DNS registration off for a launch, and the config key that looks like the way — dns.enabled — is parsed and then never read by anything.

Measured on v0.101.0 (072c4b0, binary and source the same commit).

dns.enabled is a dead switch

pkg/config/config.go:37 declares it, :77 assigns it:

cfg.Enabled = fileConfig.DNS.Enabled

That line is the only reference to the field outside the struct definition:

$ git grep -nE 'DNS\.Enabled|dnsCfg\.Enabled|dnsConfig\.Enabled'
pkg/config/config.go:77:		cfg.Enabled = fileConfig.DNS.Enabled

The single LoadDNSConfig caller (cmd/launch_single.go:883) uses dnsConfig.Domain and dnsConfig.APIEndpoint and never consults Enabled. So dns.enabled: false in ~/.spawn/config.yaml does nothing at all — registration proceeds. I was about to rely on it as the documented off-ramp; it reads exactly like a working switch.

Two smaller things fall out of the same line:

  • Enabled is a bool with no empty sentinel, so unlike Domain/APIEndpoint above it (guarded by != "") the assignment is unconditional. A config file that is present but says nothing about dns: unmarshals to Enabled: false and overwrites the true default. Inert today, but it means the field can never express "inherit" once something does read it.
  • defaults: {} in the config file can't carry it either — dns isn't among the keys pkg/config/defaults.go accepts.

Registration is unconditional for every named launch

cmd/launch_config.go:195-196:

if dnsName == "" && name != "" {
	dnsName = name
}

--dns defaults to "" (cmd/launch_flags.go:244), so the fallback makes dnsName non-empty for every launch that has a name — which is every launch, since the positional name is required. The registration guard at cmd/launch_single.go:881 is dnsName != "" && waitForSSH, so it always fires.

The only reachable escape is --wait-for-ssh=false (:877, the #56 behavior), which is not a DNS flag: it also gives up the SSH readiness wait, so a caller that needs "instance reachable, no DNS" can't have it. There's no SPAWN_DNS_ENABLED env override either — pkg/config/config.go:81-86 reads only SPAWN_DNS_DOMAIN and SPAWN_DNS_API_ENDPOINT.

Request

spawn launch --no-dns (and honoring dns.enabled: false, or removing the key if it isn't going to mean anything).

The use case is a benchmark fleet: hosts are addressed by IP out of the launcher's own inventory (spawn list --output json), a friendly name is never used, and registration is pure cost. In an account not wired for spore.host DNS it's 4 minutes per host of guaranteed-failing retries (see the companion issue on curl exit 6 being classified transient, spawn#548) — but even where it succeeds, a caller that will never resolve the name should be able to say so.

Fixing either issue alone helps; fixing this one takes the cost to zero, and fixing the other one bounds it for everybody who doesn't know the flag exists.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions