Skip to content

[PRODENG-3336] Add swarmAddress override for Swarm advertise address per host#637

Open
james-nesbitt wants to merge 1 commit into
mainfrom
PRODENG-3336
Open

[PRODENG-3336] Add swarmAddress override for Swarm advertise address per host#637
james-nesbitt wants to merge 1 commit into
mainfrom
PRODENG-3336

Conversation

@james-nesbitt
Copy link
Copy Markdown
Collaborator

@james-nesbitt james-nesbitt commented May 27, 2026

What

Add an optional swarmAddress field to the host config that overrides the Swarm advertise address used for swarm init and swarm join.

Why

In stretched/multi-DC environments, the private NIC IP (resolved from privateInterface) is not routable across DCs. Swarm uses this address for all clustering operations, so nodes in different DCs cannot reach each other. The SSH/floating address is routable but was previously unused for Swarm.

How

  • Added SwarmAddressOverride string (yaml:"swarmAddress,omitempty") to Host struct; SwarmAddress() uses it when set, falls back to InternalAddress otherwise — no behaviour change for existing configs
  • Added --advertise-addr=h.SwarmAddress() to swarm join in both join_controllers.go and join_workers.go — previously only swarm init set an advertise address; joining nodes auto-detected (always the private NIC)

Testing

  • TestHostSwarmAddressOverride: override takes precedence over InternalAddress
  • TestHostSwarmAddressOverrideEmpty: empty override falls back to InternalAddress
  • make unit-test passes (24/24 packages)

Links

Checklist

  • Tests added or updated
  • Docs updated if user-visible behaviour changed
  • No debug output or dead code left in

In stretched/multi-DC environments, nodes have a private NIC IP
(InternalAddress) that is not routable across DCs, and a floating/public
SSH address that is. Launchpad previously used InternalAddress
unconditionally for all Swarm init and join operations, causing Swarm to
fail to form across DCs.

Changes:
- Add SwarmAddressOverride field (yaml: swarmAddress) to Host config.
  When set, SwarmAddress() returns this value instead of InternalAddress.
  The field is optional — behaviour is unchanged for hosts that omit it.
- Thread --advertise-addr=h.SwarmAddress() into the swarm join command
  for both manager and worker joins. Previously only swarm init set an
  advertise address; joining nodes auto-detected their address (always
  the private NIC), which also broke cross-DC membership.
- Add TestHostSwarmAddressOverride and TestHostSwarmAddressOverrideEmpty.

PRODENG-3336
@james-nesbitt james-nesbitt added the smoke-modern Run modern smoke test label May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

smoke-modern Run modern smoke test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant