diff --git a/.changelog/8731.txt b/.changelog/8731.txt new file mode 100644 index 0000000000..4bb9599c83 --- /dev/null +++ b/.changelog/8731.txt @@ -0,0 +1,3 @@ +```release-note:bug +raft: (Enterprise only) properly update consul server meta non_voter for non-voting Enterprise Consul servers +``` diff --git a/agent/consul/leader.go b/agent/consul/leader.go index 1f50a747d0..d9a43c9b7b 100644 --- a/agent/consul/leader.go +++ b/agent/consul/leader.go @@ -1208,7 +1208,7 @@ func (s *Server) handleAliveMember(member serf.Member) error { Warning: 1, }, Meta: map[string]string{ - "non_voter": strconv.FormatBool(member.Tags["non_voter"] == "true"), + "non_voter": strconv.FormatBool(member.Tags["nonvoter"] == "1"), "raft_version": strconv.Itoa(parts.RaftVersion), "serf_protocol_current": strconv.FormatUint(uint64(member.ProtocolCur), 10), "serf_protocol_min": strconv.FormatUint(uint64(member.ProtocolMin), 10), diff --git a/agent/consul/leader_test.go b/agent/consul/leader_test.go index dffe54dd0c..d0e834b166 100644 --- a/agent/consul/leader_test.go +++ b/agent/consul/leader_test.go @@ -334,7 +334,7 @@ func TestLeader_CheckServersMeta(t *testing.T) { versionToExpect := "19.7.9" retry.Run(t, func(r *retry.R) { - member.Tags["non_voter"] = "true" + member.Tags["nonvoter"] = "1" member.Tags["build"] = versionToExpect err := s1.handleAliveMember(member) if err != nil { @@ -348,7 +348,7 @@ func TestLeader_CheckServersMeta(t *testing.T) { r.Fatal("client not registered") } if service.Meta["non_voter"] != "true" { - r.Fatalf("Expected to be non_voter == false, was: %s", service.Meta["non_voter"]) + r.Fatalf("Expected to be non_voter == true, was: %s", service.Meta["non_voter"]) } newVersion := service.Meta["version"] if newVersion != versionToExpect {