Skip to content

Commit

Permalink
autopilot: include only servers from the same region
Browse files Browse the repository at this point in the history
When we migrated to the updated autopilot library in Nomad 1.4.0, the interface
for finding servers changed. Previously autopilot would get the serf members and
call `IsServer` on each of them, leaving it up to the implementor to filter out
clients (and in Nomad's case, other regions). But in the "new" autopilot
library, the equivalent interface is `KnownServers` for which we did not filter
by region. This causes spurious attempts for the cross-region stats fetching,
which results in TLS errors and a lot of log noise.

Filter the member set by region to fix the regression.
  • Loading branch information
tgross committed Nov 17, 2022
1 parent 732adae commit 925f726
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion nomad/autopilot.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ func (s *Server) autopilotServers() map[raft.ServerID]*autopilot.Server {
s.logger.Warn("Error parsing server info", "name", member.Name, "error", err)
continue
} else if srv == nil {
// this member was a client
// this member was a client or in another region
continue
}

Expand All @@ -210,6 +210,9 @@ func (s *Server) autopilotServer(m serf.Member) (*autopilot.Server, error) {
if !ok {
return nil, nil
}
if srv.Region != s.Region() {
return nil, nil
}

return s.autopilotServerFromMetadata(srv)
}
Expand Down

0 comments on commit 925f726

Please sign in to comment.