Skip to content

Derive hostname from compose service label for scaled services (round-robin) #135

Description

@maxfield-allison

Problem statement

When a compose-managed workload has no explicit dnsweaver.hostname, dnsweaver currently derives the hostname from the instance/container name plus the domain suffix. For scaled services this produces per-replica names: deploy.replicas: 3 yields proxy-1, proxy-2, proxy-3, so with a lan suffix you get proxy-1.lan, proxy-2.lan, proxy-3.lan.

Requested by @jochumdev in #132 (review of PR #133). Both incus-compose and Docker Compose expose a stable service label:

Proposed solution

Add an opt-in mode that derives the hostname from the compose service label when no explicit hostname is set, so all replicas of a service share one round-robin name:

proxy-1, proxy-2, proxy-3  ->  proxy.lan  (3 A records, round-robin)

This is a behavior change with a deliberate semantic difference from the current per-replica naming, so it must be opt-in with clear precedence, not a silent default.

Design questions to settle

  1. Opt-in switch: a per-source or global toggle (e.g. DNSWEAVER_..._SERVICE_HOSTNAME=true)? Default off.
  2. Precedence: explicit dnsweaver.hostname > service-label-derived > instance-name-derived. Confirm ordering.
  3. Round-robin semantics: multiple instances sharing a name emit multiple A records to the same hostname. Confirm the reconciler/providers handle N records per name cleanly (ownership, updates, orphan cleanup).
  4. Cross-platform: implement once, keyed off both incus-compose.service and com.docker.compose.service, so Docker Compose users benefit too.
  5. Domain suffix: service-derived names still get the domain suffix appended the same way.

Scope

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or improvement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions