Change serf-tag references to field references.

This commit is contained in:
Derek Menteer 2022-08-31 16:38:42 -05:00
parent ce99ccd390
commit cf7f24a6ec
2 changed files with 23 additions and 28 deletions

View File

@ -1073,13 +1073,11 @@ func (s *Server) handleAliveMember(member serf.Member, nodeEntMeta *acl.Enterpri
}, },
} }
grpcPortStr := member.Tags["grpc_port"] if parts.ExternalGRPCPort > 0 {
if v, err := strconv.Atoi(grpcPortStr); err == nil && v > 0 { service.Meta["grpc_port"] = strconv.Itoa(parts.ExternalGRPCPort)
service.Meta["grpc_port"] = grpcPortStr
} }
grpcTLSPortStr := member.Tags["grpc_tls_port"] if parts.ExternalGRPCTLSPort > 0 {
if v, err := strconv.Atoi(grpcTLSPortStr); err == nil && v > 0 { service.Meta["grpc_tls_port"] = strconv.Itoa(parts.ExternalGRPCTLSPort)
service.Meta["grpc_tls_port"] = grpcTLSPortStr
} }
// Attempt to join the consul server // Attempt to join the consul server

View File

@ -23,30 +23,27 @@ func (k *Key) Equal(x *Key) bool {
// Server is used to return details of a consul server // Server is used to return details of a consul server
type Server struct { type Server struct {
Name string // <node>.<dc> Name string // <node>.<dc>
ShortName string // <node> ShortName string // <node>
ID string ID string
Datacenter string Datacenter string
Segment string Segment string
Port int Port int
SegmentAddrs map[string]string SegmentAddrs map[string]string
SegmentPorts map[string]int SegmentPorts map[string]int
WanJoinPort int WanJoinPort int
LanJoinPort int LanJoinPort int
// TODO why are these ports needed? It looks like nothing is referencing them.
ExternalGRPCPort int ExternalGRPCPort int
ExternalGRPCTLSPort int ExternalGRPCTLSPort int
Bootstrap bool
Bootstrap bool Expect int
Expect int Build version.Version
Build version.Version Version int
Version int RaftVersion int
RaftVersion int Addr net.Addr
Addr net.Addr Status serf.MemberStatus
Status serf.MemberStatus ReadReplica bool
ReadReplica bool FeatureFlags map[string]int
FeatureFlags map[string]int
// If true, use TLS when connecting to this server // If true, use TLS when connecting to this server
UseTLS bool UseTLS bool