fix(admin): fix master leader link showing incorrect port in Admin UI (#8924)

fix(admin): use gRPC address for current server in RaftListClusterServers

The old Raft implementation was returning the HTTP address
(ms.option.Master) for the current server, while peers used gRPC
addresses (peer.ConnectionString). The Admin UI's GetClusterMasters()
converts all addresses from gRPC to HTTP via GrpcAddressToServerAddress
(port - 10000), which produced a negative port (-667) for the current
server since its address was already in HTTP format (port 9333).

Use ToGrpcAddress() for consistency with both HashicorpRaft (which
stores gRPC addresses) and old Raft peers.

Fixes #8921
This commit is contained in:
Chris Lu
2026-04-04 11:50:43 -07:00
committed by GitHub
parent f6df7126b6
commit 896114d330

View File

@@ -41,7 +41,7 @@ func (ms *MasterServer) RaftListClusterServers(ctx context.Context, req *master_
// Add the current server itself (Peers() only returns other peers) // Add the current server itself (Peers() only returns other peers)
resp.ClusterServers = append(resp.ClusterServers, &master_pb.RaftListClusterServersResponse_ClusterServers{ resp.ClusterServers = append(resp.ClusterServers, &master_pb.RaftListClusterServersResponse_ClusterServers{
Id: currentServerName, Id: currentServerName,
Address: string(ms.option.Master), Address: ms.option.Master.ToGrpcAddress(),
Suffrage: "Voter", Suffrage: "Voter",
IsLeader: currentServerName == leader, IsLeader: currentServerName == leader,
}) })