Expose IsPotentialVoter for advanced autopilot logic
This commit is contained in:
parent
a4ac148077
commit
798aca92c5
|
@ -470,7 +470,7 @@ func (a *Autopilot) GetServerHealth(id string) *ServerHealth {
|
||||||
return a.clusterHealth.ServerHealth(id)
|
return a.clusterHealth.ServerHealth(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
func isPotentialVoter(suffrage raft.ServerSuffrage) bool {
|
func IsPotentialVoter(suffrage raft.ServerSuffrage) bool {
|
||||||
switch suffrage {
|
switch suffrage {
|
||||||
case raft.Voter, raft.Staging:
|
case raft.Voter, raft.Staging:
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -14,7 +14,7 @@ func PromoteStableServers(autopilotConfig *Config, health OperatorHealthReply, s
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
var promotions []raft.Server
|
var promotions []raft.Server
|
||||||
for _, server := range servers {
|
for _, server := range servers {
|
||||||
if !isPotentialVoter(server.Suffrage) {
|
if !IsPotentialVoter(server.Suffrage) {
|
||||||
health := health.ServerHealth(string(server.ID))
|
health := health.ServerHealth(string(server.ID))
|
||||||
if health.IsStable(now, autopilotConfig) {
|
if health.IsStable(now, autopilotConfig) {
|
||||||
promotions = append(promotions, server)
|
promotions = append(promotions, server)
|
||||||
|
|
Loading…
Reference in New Issue