Rename DeadServerCleanup and make wording adjustments
This commit is contained in:
parent
f7b6d776f4
commit
23c492a74e
|
@ -71,17 +71,22 @@ type KeyringResponse struct {
|
|||
NumNodes int
|
||||
}
|
||||
|
||||
// AutopilotConfiguration is used for querying/setting the Autopilot configuration
|
||||
// AutopilotConfiguration is used for querying/setting the Autopilot configuration.
|
||||
// Autopilot helps manage operator tasks related to Consul servers like removing
|
||||
// failed servers from the Raft quorum.
|
||||
type AutopilotConfiguration struct {
|
||||
// DeadServerCleanup controls whether to remove dead servers from the Raft
|
||||
// CleanupDeadServers controls whether to remove dead servers from the Raft
|
||||
// peer list when a new server joins
|
||||
DeadServerCleanup bool
|
||||
CleanupDeadServers bool
|
||||
|
||||
// CreateIndex holds the index corresponding the creation of this configuration.
|
||||
// This is a read-only field.
|
||||
CreateIndex uint64
|
||||
|
||||
// ModifyIndex is used for doing a Check-And-Set update operation.
|
||||
// ModifyIndex will be set to the index of the last update when retrieving the
|
||||
// Autopilot configuration. Resubmitting a configuration with
|
||||
// AutopilotCASConfiguration will perform a check-and-set operation which ensures
|
||||
// there hasn't been a subsequent update since the configuration was retrieved.
|
||||
ModifyIndex uint64
|
||||
}
|
||||
|
||||
|
|
|
@ -115,12 +115,12 @@ func TestOperator_AutopilotGetSetConfiguration(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
if !config.DeadServerCleanup {
|
||||
if !config.CleanupDeadServers {
|
||||
t.Fatalf("bad: %v", config)
|
||||
}
|
||||
|
||||
// Change a config setting
|
||||
newConf := &AutopilotConfiguration{DeadServerCleanup: false}
|
||||
newConf := &AutopilotConfiguration{CleanupDeadServers: false}
|
||||
if err := operator.AutopilotSetConfiguration(newConf, nil); err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ func TestOperator_AutopilotGetSetConfiguration(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
if config.DeadServerCleanup {
|
||||
if config.CleanupDeadServers {
|
||||
t.Fatalf("bad: %v", config)
|
||||
}
|
||||
}
|
||||
|
@ -144,15 +144,15 @@ func TestOperator_AutopilotCASConfiguration(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
if !config.DeadServerCleanup {
|
||||
if !config.CleanupDeadServers {
|
||||
t.Fatalf("bad: %v", config)
|
||||
}
|
||||
|
||||
// Pass an invalid ModifyIndex
|
||||
{
|
||||
newConf := &AutopilotConfiguration{
|
||||
DeadServerCleanup: false,
|
||||
ModifyIndex: config.ModifyIndex - 1,
|
||||
CleanupDeadServers: false,
|
||||
ModifyIndex: config.ModifyIndex - 1,
|
||||
}
|
||||
resp, err := operator.AutopilotCASConfiguration(newConf, nil)
|
||||
if err != nil {
|
||||
|
@ -166,8 +166,8 @@ func TestOperator_AutopilotCASConfiguration(t *testing.T) {
|
|||
// Pass a valid ModifyIndex
|
||||
{
|
||||
newConf := &AutopilotConfiguration{
|
||||
DeadServerCleanup: false,
|
||||
ModifyIndex: config.ModifyIndex,
|
||||
CleanupDeadServers: false,
|
||||
ModifyIndex: config.ModifyIndex,
|
||||
}
|
||||
resp, err := operator.AutopilotCASConfiguration(newConf, nil)
|
||||
if err != nil {
|
||||
|
|
|
@ -416,8 +416,8 @@ func (a *Agent) consulConfig() *consul.Config {
|
|||
if a.config.SessionTTLMinRaw != "" {
|
||||
base.SessionTTLMin = a.config.SessionTTLMin
|
||||
}
|
||||
if a.config.Autopilot.DeadServerCleanup != nil {
|
||||
base.AutopilotConfig.DeadServerCleanup = *a.config.Autopilot.DeadServerCleanup
|
||||
if a.config.Autopilot.CleanupDeadServers != nil {
|
||||
base.AutopilotConfig.CleanupDeadServers = *a.config.Autopilot.CleanupDeadServers
|
||||
}
|
||||
|
||||
// Format the build string
|
||||
|
|
|
@ -264,9 +264,9 @@ type Telemetry struct {
|
|||
|
||||
// Autopilot is used to configure helpful features for operating Consul servers.
|
||||
type Autopilot struct {
|
||||
// DeadServerCleanup enables the automatic cleanup of dead servers when new ones
|
||||
// CleanupDeadServers enables the automatic cleanup of dead servers when new ones
|
||||
// are added to the peer list. Defaults to true.
|
||||
DeadServerCleanup *bool `mapstructure:"dead_server_cleanup"`
|
||||
CleanupDeadServers *bool `mapstructure:"cleanup_dead_servers"`
|
||||
}
|
||||
|
||||
// Config is the configuration that can be set for an Agent.
|
||||
|
@ -1347,8 +1347,8 @@ func MergeConfig(a, b *Config) *Config {
|
|||
if b.SkipLeaveOnInt != nil {
|
||||
result.SkipLeaveOnInt = b.SkipLeaveOnInt
|
||||
}
|
||||
if b.Autopilot.DeadServerCleanup != nil {
|
||||
result.Autopilot.DeadServerCleanup = b.Autopilot.DeadServerCleanup
|
||||
if b.Autopilot.CleanupDeadServers != nil {
|
||||
result.Autopilot.CleanupDeadServers = b.Autopilot.CleanupDeadServers
|
||||
}
|
||||
if b.Telemetry.DisableHostname == true {
|
||||
result.Telemetry.DisableHostname = true
|
||||
|
|
|
@ -1110,13 +1110,13 @@ func TestDecodeConfig_Performance(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestDecodeConfig_Autopilot(t *testing.T) {
|
||||
input := `{"autopilot": { "dead_server_cleanup": true }}`
|
||||
input := `{"autopilot": { "cleanup_dead_servers": true }}`
|
||||
config, err := DecodeConfig(bytes.NewReader([]byte(input)))
|
||||
if err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
if config.Autopilot.DeadServerCleanup == nil || !*config.Autopilot.DeadServerCleanup {
|
||||
t.Fatalf("bad: dead_server_cleanup isn't set: %#v", config)
|
||||
if config.Autopilot.CleanupDeadServers == nil || !*config.Autopilot.CleanupDeadServers {
|
||||
t.Fatalf("bad: cleanup_dead_servers isn't set: %#v", config)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1643,7 +1643,7 @@ func TestMergeConfig(t *testing.T) {
|
|||
SkipLeaveOnInt: Bool(true),
|
||||
RaftProtocol: 3,
|
||||
Autopilot: Autopilot{
|
||||
DeadServerCleanup: Bool(true),
|
||||
CleanupDeadServers: Bool(true),
|
||||
},
|
||||
EnableDebug: true,
|
||||
VerifyIncoming: true,
|
||||
|
|
|
@ -306,7 +306,7 @@ func TestOperator_AutopilotGetConfiguration(t *testing.T) {
|
|||
if !ok {
|
||||
t.Fatalf("unexpected: %T", obj)
|
||||
}
|
||||
if !out.DeadServerCleanup {
|
||||
if !out.CleanupDeadServers {
|
||||
t.Fatalf("bad: %#v", out)
|
||||
}
|
||||
})
|
||||
|
@ -314,7 +314,7 @@ func TestOperator_AutopilotGetConfiguration(t *testing.T) {
|
|||
|
||||
func TestOperator_AutopilotSetConfiguration(t *testing.T) {
|
||||
httpTest(t, func(srv *HTTPServer) {
|
||||
body := bytes.NewBuffer([]byte(`{"DeadServerCleanup": false}`))
|
||||
body := bytes.NewBuffer([]byte(`{"CleanupDeadServers": false}`))
|
||||
req, err := http.NewRequest("PUT", "/v1/operator/autopilot/configuration", body)
|
||||
if err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
|
@ -336,7 +336,7 @@ func TestOperator_AutopilotSetConfiguration(t *testing.T) {
|
|||
if err := srv.agent.RPC("Operator.AutopilotGetConfiguration", &args, &reply); err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
if reply.DeadServerCleanup {
|
||||
if reply.CleanupDeadServers {
|
||||
t.Fatalf("bad: %#v", reply)
|
||||
}
|
||||
})
|
||||
|
@ -344,7 +344,7 @@ func TestOperator_AutopilotSetConfiguration(t *testing.T) {
|
|||
|
||||
func TestOperator_AutopilotCASConfiguration(t *testing.T) {
|
||||
httpTest(t, func(srv *HTTPServer) {
|
||||
body := bytes.NewBuffer([]byte(`{"DeadServerCleanup": false}`))
|
||||
body := bytes.NewBuffer([]byte(`{"CleanupDeadServers": false}`))
|
||||
req, err := http.NewRequest("PUT", "/v1/operator/autopilot/configuration", body)
|
||||
if err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
|
@ -367,13 +367,13 @@ func TestOperator_AutopilotCASConfiguration(t *testing.T) {
|
|||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
|
||||
if reply.DeadServerCleanup {
|
||||
if reply.CleanupDeadServers {
|
||||
t.Fatalf("bad: %#v", reply)
|
||||
}
|
||||
|
||||
// Create a CAS request, bad index
|
||||
{
|
||||
buf := bytes.NewBuffer([]byte(`{"DeadServerCleanup": true}`))
|
||||
buf := bytes.NewBuffer([]byte(`{"CleanupDeadServers": true}`))
|
||||
req, err := http.NewRequest("PUT",
|
||||
fmt.Sprintf("/v1/operator/autopilot/configuration?cas=%d", reply.ModifyIndex-1), buf)
|
||||
if err != nil {
|
||||
|
@ -393,7 +393,7 @@ func TestOperator_AutopilotCASConfiguration(t *testing.T) {
|
|||
|
||||
// Create a CAS request, good index
|
||||
{
|
||||
buf := bytes.NewBuffer([]byte(`{"DeadServerCleanup": true}`))
|
||||
buf := bytes.NewBuffer([]byte(`{"CleanupDeadServers": true}`))
|
||||
req, err := http.NewRequest("PUT",
|
||||
fmt.Sprintf("/v1/operator/autopilot/configuration?cas=%d", reply.ModifyIndex), buf)
|
||||
if err != nil {
|
||||
|
@ -415,7 +415,7 @@ func TestOperator_AutopilotCASConfiguration(t *testing.T) {
|
|||
if err := srv.agent.RPC("Operator.AutopilotGetConfiguration", &args, &reply); err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
if !reply.DeadServerCleanup {
|
||||
if !reply.CleanupDeadServers {
|
||||
t.Fatalf("bad: %#v", reply)
|
||||
}
|
||||
})
|
||||
|
|
|
@ -55,7 +55,7 @@ func (c *OperatorAutopilotGetCommand) Run(args []string) int {
|
|||
c.Ui.Error(fmt.Sprintf("Error querying Autopilot configuration: %s", err))
|
||||
return 1
|
||||
}
|
||||
c.Ui.Output(fmt.Sprintf("DeadServerCleanup = %v", config.DeadServerCleanup))
|
||||
c.Ui.Output(fmt.Sprintf("CleanupDeadServers = %v", config.CleanupDeadServers))
|
||||
|
||||
return 0
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ func TestOperator_Autopilot_Get(t *testing.T) {
|
|||
t.Fatalf("bad: %d. %#v", code, ui.ErrorWriter.String())
|
||||
}
|
||||
output := strings.TrimSpace(ui.OutputWriter.String())
|
||||
if !strings.Contains(output, "DeadServerCleanup = true") {
|
||||
if !strings.Contains(output, "CleanupDeadServers = true") {
|
||||
t.Fatalf("bad: %s", output)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,11 +28,11 @@ func (c *OperatorAutopilotSetCommand) Synopsis() string {
|
|||
}
|
||||
|
||||
func (c *OperatorAutopilotSetCommand) Run(args []string) int {
|
||||
var deadServerCleanup base.BoolValue
|
||||
var cleanupDeadServers base.BoolValue
|
||||
|
||||
f := c.Command.NewFlagSet(c)
|
||||
|
||||
f.Var(&deadServerCleanup, "dead-server-cleanup",
|
||||
f.Var(&cleanupDeadServers, "cleanup-dead-servers",
|
||||
"Controls whether Consul will automatically remove dead servers "+
|
||||
"when new ones are successfully added. Must be one of `true|false`.")
|
||||
|
||||
|
@ -60,7 +60,7 @@ func (c *OperatorAutopilotSetCommand) Run(args []string) int {
|
|||
}
|
||||
|
||||
// Update the config values.
|
||||
deadServerCleanup.Merge(&conf.DeadServerCleanup)
|
||||
cleanupDeadServers.Merge(&conf.CleanupDeadServers)
|
||||
|
||||
// Check-and-set the new configuration.
|
||||
result, err := operator.AutopilotCASConfiguration(conf, nil)
|
||||
|
@ -72,7 +72,7 @@ func (c *OperatorAutopilotSetCommand) Run(args []string) int {
|
|||
c.Ui.Output("Configuration updated!")
|
||||
return 0
|
||||
} else {
|
||||
c.Ui.Output("Configuration could not be atomically updated")
|
||||
c.Ui.Output("Configuration could not be atomically updated, please try again")
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ func TestOperator_Autopilot_Set(t *testing.T) {
|
|||
Flags: base.FlagSetHTTP,
|
||||
},
|
||||
}
|
||||
args := []string{"-http-addr=" + a1.httpAddr, "-dead-server-cleanup=false"}
|
||||
args := []string{"-http-addr=" + a1.httpAddr, "-cleanup-dead-servers=false"}
|
||||
|
||||
code := c.Run(args)
|
||||
if code != 0 {
|
||||
|
@ -44,7 +44,7 @@ func TestOperator_Autopilot_Set(t *testing.T) {
|
|||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
|
||||
if reply.DeadServerCleanup {
|
||||
if reply.CleanupDeadServers {
|
||||
t.Fatalf("bad: %#v", reply)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -353,7 +353,7 @@ func DefaultConfig() *Config {
|
|||
TLSMinVersion: "tls10",
|
||||
|
||||
AutopilotConfig: &structs.AutopilotConfig{
|
||||
DeadServerCleanup: true,
|
||||
CleanupDeadServers: true,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -618,7 +618,7 @@ func (s *Server) joinConsulServer(m serf.Member, parts *agent.Server) error {
|
|||
}
|
||||
|
||||
// Look for dead servers to clean up
|
||||
if autopilotConf.DeadServerCleanup {
|
||||
if autopilotConf.CleanupDeadServers {
|
||||
for _, member := range s.serfLAN.Members() {
|
||||
valid, _ := agent.IsConsulServer(member)
|
||||
if valid && member.Name != m.Name && member.Status == serf.StatusFailed {
|
||||
|
|
|
@ -623,7 +623,7 @@ func TestLeader_ReapTombstones(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestLeader_DeadServerCleanup(t *testing.T) {
|
||||
func TestLeader_CleanupDeadServers(t *testing.T) {
|
||||
dir1, s1 := testServerDCBootstrap(t, "dc1", true)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
|
|
@ -141,8 +141,6 @@ func (op *Operator) AutopilotGetConfiguration(args *structs.DCSpecificRequest, r
|
|||
return permissionDeniedErr
|
||||
}
|
||||
|
||||
// We can't fetch the leader and the configuration atomically with
|
||||
// the current Raft API.
|
||||
state := op.srv.fsm.State()
|
||||
_, config, err := state.AutopilotConfig()
|
||||
if err != nil {
|
||||
|
@ -160,7 +158,7 @@ func (op *Operator) AutopilotSetConfiguration(args *structs.AutopilotSetConfigRe
|
|||
return err
|
||||
}
|
||||
|
||||
// This action requires operator read access.
|
||||
// This action requires operator write access.
|
||||
acl, err := op.srv.resolveToken(args.Token)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
@ -246,7 +246,7 @@ func TestOperator_RaftRemovePeerByAddress_ACLDeny(t *testing.T) {
|
|||
|
||||
func TestOperator_Autopilot_GetConfiguration(t *testing.T) {
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.AutopilotConfig.DeadServerCleanup = false
|
||||
c.AutopilotConfig.CleanupDeadServers = false
|
||||
})
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -263,7 +263,7 @@ func TestOperator_Autopilot_GetConfiguration(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
if reply.DeadServerCleanup {
|
||||
if reply.CleanupDeadServers {
|
||||
t.Fatalf("bad: %#v", reply)
|
||||
}
|
||||
}
|
||||
|
@ -273,7 +273,7 @@ func TestOperator_Autopilot_GetConfiguration_ACLDeny(t *testing.T) {
|
|||
c.ACLDatacenter = "dc1"
|
||||
c.ACLMasterToken = "root"
|
||||
c.ACLDefaultPolicy = "deny"
|
||||
c.AutopilotConfig.DeadServerCleanup = false
|
||||
c.AutopilotConfig.CleanupDeadServers = false
|
||||
})
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -320,14 +320,14 @@ func TestOperator_Autopilot_GetConfiguration_ACLDeny(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
if reply.DeadServerCleanup {
|
||||
if reply.CleanupDeadServers {
|
||||
t.Fatalf("bad: %#v", reply)
|
||||
}
|
||||
}
|
||||
|
||||
func TestOperator_Autopilot_SetConfiguration(t *testing.T) {
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.AutopilotConfig.DeadServerCleanup = false
|
||||
c.AutopilotConfig.CleanupDeadServers = false
|
||||
})
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -340,7 +340,7 @@ func TestOperator_Autopilot_SetConfiguration(t *testing.T) {
|
|||
arg := structs.AutopilotSetConfigRequest{
|
||||
Datacenter: "dc1",
|
||||
Config: structs.AutopilotConfig{
|
||||
DeadServerCleanup: true,
|
||||
CleanupDeadServers: true,
|
||||
},
|
||||
}
|
||||
var reply *bool
|
||||
|
@ -355,7 +355,7 @@ func TestOperator_Autopilot_SetConfiguration(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !config.DeadServerCleanup {
|
||||
if !config.CleanupDeadServers {
|
||||
t.Fatalf("bad: %#v", config)
|
||||
}
|
||||
}
|
||||
|
@ -365,7 +365,7 @@ func TestOperator_Autopilot_SetConfiguration_ACLDeny(t *testing.T) {
|
|||
c.ACLDatacenter = "dc1"
|
||||
c.ACLMasterToken = "root"
|
||||
c.ACLDefaultPolicy = "deny"
|
||||
c.AutopilotConfig.DeadServerCleanup = false
|
||||
c.AutopilotConfig.CleanupDeadServers = false
|
||||
})
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -378,7 +378,7 @@ func TestOperator_Autopilot_SetConfiguration_ACLDeny(t *testing.T) {
|
|||
arg := structs.AutopilotSetConfigRequest{
|
||||
Datacenter: "dc1",
|
||||
Config: structs.AutopilotConfig{
|
||||
DeadServerCleanup: true,
|
||||
CleanupDeadServers: true,
|
||||
},
|
||||
}
|
||||
var reply *bool
|
||||
|
@ -422,7 +422,7 @@ func TestOperator_Autopilot_SetConfiguration_ACLDeny(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !config.DeadServerCleanup {
|
||||
if !config.CleanupDeadServers {
|
||||
t.Fatalf("bad: %#v", config)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ func TestStateStore_Autopilot(t *testing.T) {
|
|||
s := testStateStore(t)
|
||||
|
||||
expected := &structs.AutopilotConfig{
|
||||
DeadServerCleanup: true,
|
||||
CleanupDeadServers: true,
|
||||
}
|
||||
|
||||
if err := s.AutopilotSetConfig(0, expected); err != nil {
|
||||
|
@ -34,7 +34,7 @@ func TestStateStore_AutopilotCAS(t *testing.T) {
|
|||
s := testStateStore(t)
|
||||
|
||||
expected := &structs.AutopilotConfig{
|
||||
DeadServerCleanup: true,
|
||||
CleanupDeadServers: true,
|
||||
}
|
||||
|
||||
if err := s.AutopilotSetConfig(0, expected); err != nil {
|
||||
|
@ -46,14 +46,14 @@ func TestStateStore_AutopilotCAS(t *testing.T) {
|
|||
|
||||
// Do a CAS with an index lower than the entry
|
||||
ok, err := s.AutopilotCASConfig(2, 0, &structs.AutopilotConfig{
|
||||
DeadServerCleanup: false,
|
||||
CleanupDeadServers: false,
|
||||
})
|
||||
if ok || err != nil {
|
||||
t.Fatalf("expected (false, nil), got: (%v, %#v)", ok, err)
|
||||
}
|
||||
|
||||
// Check that the index is untouched and the entry
|
||||
// has not been deleted.
|
||||
// has not been updated.
|
||||
idx, config, err := s.AutopilotConfig()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
@ -61,20 +61,19 @@ func TestStateStore_AutopilotCAS(t *testing.T) {
|
|||
if idx != 1 {
|
||||
t.Fatalf("bad: %d", idx)
|
||||
}
|
||||
if !config.DeadServerCleanup {
|
||||
if !config.CleanupDeadServers {
|
||||
t.Fatalf("bad: %#v", config)
|
||||
}
|
||||
|
||||
// Do another CAS, this time with the correct index
|
||||
ok, err = s.AutopilotCASConfig(2, 1, &structs.AutopilotConfig{
|
||||
DeadServerCleanup: false,
|
||||
CleanupDeadServers: false,
|
||||
})
|
||||
if !ok || err != nil {
|
||||
t.Fatalf("expected (true, nil), got: (%v, %#v)", ok, err)
|
||||
}
|
||||
|
||||
// Check that the index is untouched and the entry
|
||||
// has not been deleted.
|
||||
// Make sure the config was updated
|
||||
idx, config, err = s.AutopilotConfig()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
@ -82,7 +81,7 @@ func TestStateStore_AutopilotCAS(t *testing.T) {
|
|||
if idx != 2 {
|
||||
t.Fatalf("bad: %d", idx)
|
||||
}
|
||||
if config.DeadServerCleanup {
|
||||
if config.CleanupDeadServers {
|
||||
t.Fatalf("bad: %#v", config)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,9 +5,9 @@ import (
|
|||
)
|
||||
|
||||
type AutopilotConfig struct {
|
||||
// DeadServerCleanup controls whether to remove dead servers when a new
|
||||
// CleanupDeadServers controls whether to remove dead servers when a new
|
||||
// server is added to the Raft peers
|
||||
DeadServerCleanup bool
|
||||
CleanupDeadServers bool
|
||||
|
||||
// RaftIndex stores the create/modify indexes of this configuration
|
||||
RaftIndex
|
||||
|
|
|
@ -287,13 +287,13 @@ A JSON body is returned that looks like this:
|
|||
|
||||
```javascript
|
||||
{
|
||||
"DeadServerCleanup": true,
|
||||
"CleanupDeadServers": true,
|
||||
"CreateIndex": 4,
|
||||
"ModifyIndex": 4
|
||||
}
|
||||
```
|
||||
|
||||
`DeadServerCleanup` is whether dead servers should be removed automatically when
|
||||
`CleanupDeadServers` is whether dead servers should be removed automatically when
|
||||
a new server is added to the cluster.
|
||||
|
||||
#### PUT Method
|
||||
|
@ -313,11 +313,11 @@ body must look like:
|
|||
|
||||
```javascript
|
||||
{
|
||||
"DeadServerCleanup": true
|
||||
"CleanupDeadServers": true
|
||||
}
|
||||
```
|
||||
|
||||
`DeadServerCleanup` is whether dead servers should be removed automatically when
|
||||
`CleanupDeadServers` is whether dead servers should be removed automatically when
|
||||
a new server is added to the cluster.
|
||||
|
||||
The return code will indicate success or failure.
|
||||
|
|
|
@ -563,9 +563,9 @@ Consul will not enable TLS for the HTTP API unless the `https` port has been ass
|
|||
* <a name="raft_protocol"></a><a href="#raft_protocol">`raft_protocol`</a> - This controls the internal
|
||||
version of the Raft consensus protocol used for server communications. This defaults to 2 but must
|
||||
be set to 3 in order to gain access to other Autopilot features, with the exception of
|
||||
[`dead_server_cleanup`](#dead_server_cleanup).
|
||||
[`cleanup_dead_servers`](#cleanup_dead_servers).
|
||||
|
||||
* <a name="dead_server_cleanup"></a><a href="#dead_server_cleanup">`dead_server_cleanup`</a> - This controls
|
||||
* <a name="cleanup_dead_servers"></a><a href="#cleanup_dead_servers">`cleanup_dead_servers`</a> - This controls
|
||||
the automatic removal of dead server nodes whenever a new server is added to the cluster. Defaults to `true`.
|
||||
|
||||
* <a name="bootstrap"></a><a href="#bootstrap">`bootstrap`</a> Equivalent to the
|
||||
|
|
|
@ -39,7 +39,7 @@ Usage: `consul operator autopilot get-config [options]`
|
|||
The output looks like this:
|
||||
|
||||
```
|
||||
DeadServerCleanup = true
|
||||
CleanupDeadServers = true
|
||||
```
|
||||
|
||||
## set-config
|
||||
|
@ -55,7 +55,7 @@ Usage: `consul operator autopilot set-config [options]`
|
|||
|
||||
#### Command Options
|
||||
|
||||
* `-dead-server-cleanup` - Specifies whether to enable automatic removal of dead servers
|
||||
* `-cleanup-dead-servers` - Specifies whether to enable automatic removal of dead servers
|
||||
upon the successful joining of new servers to the cluster. Must be one of `[true|false]`.
|
||||
|
||||
The output looks like this:
|
||||
|
|
Loading…
Reference in New Issue