Help us shape the future of Go! Take the 2026 Go Developer Survey

autopilot

package module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 13, 2020 License: MIT Imports: 6 Imported by: 0

README

Autopilot

This library contains extended funcionality to use with Consul autopilot.

Functionality

  • Allows setting non voting servers. Those servers won't be included as voters. This allows you to add more servers without impacting the number os servers that are included in the voting decissions.
  • A zone can be specified to each server and if enabled, only one server per zone will act as voter.
  • The version of the voters can be upgraded automatically.

Usage

To use it you only need to do the following:

package main

import (
    "github.com/hashicorp/consul/agent/consul/autopilot"
    improvedAutopilot "github.com/jorgemarey/autopilot"
)

func example() *autopilot.Autopilot {
    var defaultDelegate autopilot.Delegate // construct the default autopilot.Delegate
    ...
    apDelegate := improvedAutopilot.New(nil, defaultDelegate) // you can provide a logger if needed
    return autopilot.NewAutopilot(nil, apDelegate, 10 * time.Second, 10 * time.Second)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PromoteServers

func PromoteServers(config *autopilot.Config, servers []raft.Server, info map[raft.ServerID]*serverInfo, peers int) ([]raft.Server, *raft.ServerID)

PromoteServers is an advanced policy that has zones and versions. In servers should come all those servers that are not voting at the moment but are stable

Types

type AdvancedAutopilotDelegate

type AdvancedAutopilotDelegate struct {
	autopilot.Delegate
	// contains filtered or unexported fields
}

AdvancedAutopilotDelegate is a delegate for autopilot operations. This can check zones, versions and non voting servers

func New

New returns a new AutopilotDelegate using the provided and with improved promotion features

func (*AdvancedAutopilotDelegate) PromoteNonVoters

func (d *AdvancedAutopilotDelegate) PromoteNonVoters(conf *autopilot.Config, health autopilot.OperatorHealthReply) ([]raft.Server, error)

PromoteNonVoters implements autopilot.Delegate.PromoteNonVoters

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL