mirror of
https://github.com/status-im/consul.git
synced 2025-01-11 06:16:08 +00:00
Store WanAddress during node registration
This commit is contained in:
parent
90aafbbdb6
commit
9300a13643
@ -181,6 +181,9 @@ func (c *Client) setupSerf(conf *serf.Config, ch chan serf.Event, path string) (
|
||||
conf.RejoinAfterLeave = c.config.RejoinAfterLeave
|
||||
conf.Merge = &lanMergeDelegate{dc: c.config.Datacenter}
|
||||
conf.DisableCoordinates = c.config.DisableCoordinates
|
||||
if wanAddr := c.config.SerfWANConfig.MemberlistConfig.AdvertiseAddr; wanAddr != "" {
|
||||
conf.Tags["WanAddr"] = wanAddr
|
||||
}
|
||||
if err := ensurePath(conf.SnapshotPath, false); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -472,8 +472,9 @@ func (s *consulSnapshot) persistNodes(sink raft.SnapshotSink,
|
||||
for node := nodes.Next(); node != nil; node = nodes.Next() {
|
||||
n := node.(*structs.Node)
|
||||
req := structs.RegisterRequest{
|
||||
Node: n.Node,
|
||||
Address: n.Address,
|
||||
Node: n.Node,
|
||||
Address: n.Address,
|
||||
WanAddress: n.WanAddress,
|
||||
}
|
||||
|
||||
// Register the node itself
|
||||
|
@ -418,6 +418,7 @@ AFTER_CHECK:
|
||||
Datacenter: s.config.Datacenter,
|
||||
Node: member.Name,
|
||||
Address: member.Addr.String(),
|
||||
WanAddress: member.Tags["WanAddr"],
|
||||
Service: service,
|
||||
Check: &structs.HealthCheck{
|
||||
Node: member.Name,
|
||||
@ -460,6 +461,7 @@ func (s *Server) handleFailedMember(member serf.Member) error {
|
||||
Datacenter: s.config.Datacenter,
|
||||
Node: member.Name,
|
||||
Address: member.Addr.String(),
|
||||
WanAddress: member.Tags["WanAddr"],
|
||||
Check: &structs.HealthCheck{
|
||||
Node: member.Name,
|
||||
CheckID: SerfCheckID,
|
||||
|
@ -299,6 +299,9 @@ func (s *Server) setupSerf(conf *serf.Config, ch chan serf.Event, path string, w
|
||||
if s.config.BootstrapExpect != 0 {
|
||||
conf.Tags["expect"] = fmt.Sprintf("%d", s.config.BootstrapExpect)
|
||||
}
|
||||
if wanAddr := s.config.SerfWANConfig.MemberlistConfig.AdvertiseAddr; wanAddr != "" {
|
||||
conf.Tags["WanAddr"] = wanAddr
|
||||
}
|
||||
conf.MemberlistConfig.LogOutput = s.config.LogOutput
|
||||
conf.LogOutput = s.config.LogOutput
|
||||
conf.EventCh = ch
|
||||
|
Loading…
x
Reference in New Issue
Block a user