Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix wrong control plane discovery, when serf advertised address located in network, unreachable from clients #11895

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2773,7 +2773,7 @@ DISCOLOOP:
continue
}
var peers []string
if err := c.connPool.RPC(region, addr, c.RPCMajorVersion(), "Status.Peers", rpcargs, &peers); err != nil {
if err := c.connPool.RPC(region, addr, c.RPCMajorVersion(), "Status.RpcPeers", rpcargs, &peers); err != nil {
mErr.Errors = append(mErr.Errors, err)
continue
}
Expand Down
23 changes: 23 additions & 0 deletions nomad/status_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,29 @@ func (s *Status) Peers(args *structs.GenericRequest, reply *[]string) error {
return nil
}

// RpcPeers is used to get all the Rpc servers, when gaent discovered them throw consul
func (s *Status) RpcPeers(args *structs.GenericRequest, reply *[]string) error {
if args.Region == "" {
args.Region = s.srv.config.Region
}
if done, err := s.srv.forward("Status.RpcPeers", args, args, reply); done {
return err
}

future := s.srv.raft.GetConfiguration()
if err := future.Error(); err != nil {
return err
}

s.srv.peerLock.RLock()
defer s.srv.peerLock.RUnlock()

for _, server := range future.Configuration().Servers {
*reply = append(*reply, s.srv.localPeers[server.Address].RPCAddr.String())
}
return nil
}

// Members return the list of servers in a cluster that a particular server is
// aware of
func (s *Status) Members(args *structs.GenericRequest, reply *structs.ServerMembersResponse) error {
Expand Down