agent: added metadata information about servers into consul service description (#5455)

This allows have information about servers from HTTP APIs without
using the command line.
This commit is contained in:
Pierre Souchay 2019-06-26 23:46:47 +02:00 committed by Hans Hasselberg
parent e946ed9427
commit ca7c7faac8
1 changed files with 11 additions and 0 deletions

View File

@ -1363,6 +1363,17 @@ func (s *Server) handleAliveMember(member serf.Member) error {
ID: structs.ConsulServiceID,
Service: structs.ConsulServiceName,
Port: parts.Port,
Weights: &structs.Weights{
Passing: 1,
Warning: 1,
},
Meta: map[string]string{
"raft_version": strconv.Itoa(parts.RaftVersion),
"serf_protocol_current": strconv.FormatUint(uint64(member.ProtocolCur), 10),
"serf_protocol_min": strconv.FormatUint(uint64(member.ProtocolMin), 10),
"serf_protocol_max": strconv.FormatUint(uint64(member.ProtocolMax), 10),
"version": parts.Build.String(),
},
}
// Attempt to join the consul server