From 798aca92c585259df2b547b12d65d1481aee6bdc Mon Sep 17 00:00:00 2001 From: Kyle Havlovitz Date: Wed, 13 Dec 2017 17:53:26 -0800 Subject: [PATCH] Expose IsPotentialVoter for advanced autopilot logic --- agent/consul/autopilot/autopilot.go | 2 +- agent/consul/autopilot/promotion.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/agent/consul/autopilot/autopilot.go b/agent/consul/autopilot/autopilot.go index 9bbc15e63..af36d5a2c 100644 --- a/agent/consul/autopilot/autopilot.go +++ b/agent/consul/autopilot/autopilot.go @@ -470,7 +470,7 @@ func (a *Autopilot) GetServerHealth(id string) *ServerHealth { return a.clusterHealth.ServerHealth(id) } -func isPotentialVoter(suffrage raft.ServerSuffrage) bool { +func IsPotentialVoter(suffrage raft.ServerSuffrage) bool { switch suffrage { case raft.Voter, raft.Staging: return true diff --git a/agent/consul/autopilot/promotion.go b/agent/consul/autopilot/promotion.go index bd10e70ed..d76540d15 100644 --- a/agent/consul/autopilot/promotion.go +++ b/agent/consul/autopilot/promotion.go @@ -14,7 +14,7 @@ func PromoteStableServers(autopilotConfig *Config, health OperatorHealthReply, s now := time.Now() var promotions []raft.Server for _, server := range servers { - if !isPotentialVoter(server.Suffrage) { + if !IsPotentialVoter(server.Suffrage) { health := health.ServerHealth(string(server.ID)) if health.IsStable(now, autopilotConfig) { promotions = append(promotions, server)