Browse Source

Store WanAddress during Service/Check sync

pull/1698/head
James Phillips 9 years ago
parent
commit
ed8a71efd7
  1. 2
      command/agent/local.go
  2. 5
      consul/leader.go

2
command/agent/local.go

@ -526,6 +526,7 @@ func (l *localState) syncService(id string) error {
Datacenter: l.config.Datacenter,
Node: l.config.NodeName,
Address: l.config.AdvertiseAddr,
WanAddress: l.config.ConsulConfig.SerfWANConfig.MemberlistConfig.AdvertiseAddr,
Service: l.services[id],
WriteRequest: structs.WriteRequest{Token: l.serviceToken(id)},
}
@ -583,6 +584,7 @@ func (l *localState) syncCheck(id string) error {
Datacenter: l.config.Datacenter,
Node: l.config.NodeName,
Address: l.config.AdvertiseAddr,
WanAddress: l.config.ConsulConfig.SerfWANConfig.MemberlistConfig.AdvertiseAddr,
Service: service,
Check: l.checks[id],
WriteRequest: structs.WriteRequest{Token: l.checkToken(id)},

5
consul/leader.go

@ -380,6 +380,11 @@ func (s *Server) handleAliveMember(member serf.Member) error {
return err
}
if node != nil && node.Address == member.Addr.String() {
// Check if the WAN address was updated
if node.WanAddress != member.Tags["WanAddr"] {
goto AFTER_CHECK
}
// Check if the associated service is available
if service != nil {
match := false

Loading…
Cancel
Save