Store WanAddress during Service/Check sync

This commit is contained in:
James Phillips 2015-12-08 18:31:58 -08:00
parent 9300a13643
commit ed8a71efd7
2 changed files with 7 additions and 0 deletions

View File

@ -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)},

View File

@ -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