Browse Source

network_segments: stop advertising segment tags

pull/7786/head
Hans Hasselberg 5 years ago
parent
commit
096a2f2f02
  1. 5
      agent/consul/server_serf.go
  2. 2
      agent/consul/server_test.go
  3. 37
      agent/router/serf_flooder.go

5
agent/consul/server_serf.go

@ -49,11 +49,6 @@ func (s *Server) setupSerf(conf *serf.Config, ch chan serf.Event, path string, w
conf.Tags["role"] = "consul"
conf.Tags["dc"] = s.config.Datacenter
conf.Tags["segment"] = segment
if segment == "" {
for _, s := range s.config.Segments {
conf.Tags["sl_"+s.Name] = net.JoinHostPort(s.Advertise, fmt.Sprintf("%d", s.Port))
}
}
conf.Tags["id"] = string(s.config.NodeID)
conf.Tags["vsn"] = fmt.Sprintf("%d", s.config.ProtocolVersion)
conf.Tags["vsn_min"] = fmt.Sprintf("%d", ProtocolVersionMin)

2
agent/consul/server_test.go

@ -145,7 +145,7 @@ func testServerConfig(t *testing.T) (string, *Config) {
config.ServerHealthInterval = 50 * time.Millisecond
config.AutopilotInterval = 100 * time.Millisecond
config.Build = "1.4.0"
config.Build = "1.7.2"
config.CoordinateUpdatePeriod = 100 * time.Millisecond
config.LeaveDrainTime = 1 * time.Millisecond

37
agent/router/serf_flooder.go

@ -56,10 +56,6 @@ func FloodJoins(logger hclog.Logger, addrFn FloodAddrFn,
continue
}
// TODO make RPC
// TODO refactor into one function:
addr, err := addrFn(server)
if err != nil {
logger.Debug("Failed to flood-join server", "server",
@ -68,39 +64,6 @@ func FloodJoins(logger hclog.Logger, addrFn FloodAddrFn,
)
continue
}
// // We can't use the port number from the src Serf, so we just
// // get the host part.
// addr, _, err := net.SplitHostPort(server.Addr.String())
// if err != nil {
// logger.Debug("Failed to flood-join server (bad address)",
// "server", server.Name,
// "address", server.Addr.String(),
// "error", err,
// )
// }
// if addrFn != nil {
// if a, ok := addrFn(server); ok {
// addr = a
// }
// }
// // Let the callback see if it can get the port number, otherwise
// // leave it blank to behave as if we just supplied an address.
// if port, ok := portFn(server); ok {
// addr = net.JoinHostPort(addr, fmt.Sprintf("%d", port))
// } else {
// // If we have an IPv6 address, we should add brackets,
// // single dstSerf.Join expects that.
// if ip := net.ParseIP(addr); ip != nil {
// if ip.To4() == nil {
// addr = fmt.Sprintf("[%s]", addr)
// }
// } else {
// logger.Debug("Failed to parse IP", "ip", addr)
// }
// }
// end refactor
dstServerName := fmt.Sprintf("%s.%s", server.Name, server.Datacenter)

Loading…
Cancel
Save