UI incorrectly shows client agent as leader
- Dominant language
- Go
- Stars
- 30.1k
- Forks
- 4.6k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 43
Description
## Bug
I'm testing local (single-host) non-dev consul cluster for nomad, and I found UI shows both client and server agent as "leader" when both are on the same host (in my case `127.0.0.1`)
Since the specific agent, not the host, is the leader, this is incorrect behavior.

(BTW "Node" is not in https://www.consul.io/docs/install/glossary - so it's confusing :cry:)
Probably it is because UI detects the leader with host name, not with id of agent? (https://github.com/hashicorp/consul/blob/v1.9.1/ui/packages/consul-ui/app/templates/dc/nodes/index.hbs#L47)
## Configuration
```
# consul-server1.hcl
node_name = "server1"
data_dir = "/tmp/consul-server1"
bind_addr = "127.0.0.1"
server = true
ui = true
bootstrap_expect = 1
ports {
dns = 18600
http = 18500
grpc = 18502
serf_lan = 18301
serf_wan = 18302
}
connect {
enabled = true
}
```
```
# consul-client-nomad-server1.hcl
node_name = "client-nomad-server1"
data_dir = "/tmp/consul-client-nomad-server1"
bind_addr = "127.0.0.1"
start_join = ["127.0.0.1:18301"]
ports {
dns = 8600
http = 8500
serf_lan = 8301
serf_wan = 8302
}
```
## Outputs
```
consul members
Node Address Status Type Build Protocol DC Segment
server1 127.0.0.1:18301 alive server 1.9.1 2 dc1
client-nomad-server1 127.0.0.1:8301 alive client 1.9.1 2 dc1
```
```
consul operator raft list-peers
Node ID Address State Voter RaftProtocol
server1 178dc126-1a2d-4add-8a57-db9954578dce 127.0.0.1:8300 leader true 3
```
Contributor guide
Assessment
This issue has not been assessed yet.