[PRODENG-3336] Add swarmAddress override for Swarm advertise address per host#637
Open
james-nesbitt wants to merge 1 commit into
Open
[PRODENG-3336] Add swarmAddress override for Swarm advertise address per host#637james-nesbitt wants to merge 1 commit into
james-nesbitt wants to merge 1 commit into
Conversation
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
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.
What
Add an optional
swarmAddressfield to the host config that overrides the Swarm advertise address used forswarm initandswarm 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
SwarmAddressOverride string(yaml:"swarmAddress,omitempty") toHoststruct;SwarmAddress()uses it when set, falls back toInternalAddressotherwise — no behaviour change for existing configs--advertise-addr=h.SwarmAddress()toswarm joinin bothjoin_controllers.goandjoin_workers.go— previously onlyswarm initset an advertise address; joining nodes auto-detected (always the private NIC)Testing
TestHostSwarmAddressOverride: override takes precedence overInternalAddressTestHostSwarmAddressOverrideEmpty: empty override falls back toInternalAddressmake unit-testpasses (24/24 packages)Links
Checklist