Expose IsPotentialVoter for advanced autopilot logic

This commit is contained in:
Kyle Havlovitz 2017-12-13 17:53:26 -08:00
parent a4ac148077
commit 798aca92c5
No known key found for this signature in database
GPG Key ID: 8A5E6B173056AD6C
2 changed files with 2 additions and 2 deletions

View File

@ -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

View File

@ -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)