diff --git a/command/agent/config-test-fixtures/basic.hcl b/command/agent/config-test-fixtures/basic.hcl index 8b1b10331289..d6ee51e13c9d 100644 --- a/command/agent/config-test-fixtures/basic.hcl +++ b/command/agent/config-test-fixtures/basic.hcl @@ -32,8 +32,8 @@ client { } server_join { retry_join = [ "1.1.1.1", "2.2.2.2" ] - retry_max = 3 - retry_interval = "15s" + retry_max = 3 + retry_interval = "15s" } options { @@ -95,9 +95,8 @@ server { encrypt = "abc" server_join { retry_join = [ "1.1.1.1", "2.2.2.2" ] - start_join = [ "1.1.1.1", "2.2.2.2" ] - retry_max = 3 - retry_interval = "15s" + retry_max = 3 + retry_interval = "15s" } } acl { diff --git a/command/agent/config.go b/command/agent/config.go index 0398b5004ece..376ce7b8df68 100644 --- a/command/agent/config.go +++ b/command/agent/config.go @@ -366,7 +366,8 @@ type ServerJoin struct { // addresses, then the agent will error and exit. StartJoin []string `mapstructure:"start_join"` - // RetryJoin is a list of addresses to join with retry enabled. + // RetryJoin is a list of addresses to join with retry enabled, or a single + // value to find multiple servers using go-discover syntax. RetryJoin []string `mapstructure:"retry_join"` // RetryMaxAttempts specifies the maximum number of times to retry joining a diff --git a/command/agent/config_parse_test.go b/command/agent/config_parse_test.go index 137d0efd8511..92485cd82b7c 100644 --- a/command/agent/config_parse_test.go +++ b/command/agent/config_parse_test.go @@ -113,7 +113,6 @@ func TestConfig_Parse(t *testing.T) { EncryptKey: "abc", ServerJoin: &ServerJoin{ RetryJoin: []string{"1.1.1.1", "2.2.2.2"}, - StartJoin: []string{"1.1.1.1", "2.2.2.2"}, RetryInterval: time.Duration(15) * time.Second, RetryMaxAttempts: 3, }, diff --git a/command/agent/retry_join.go b/command/agent/retry_join.go index 3600ba7b4884..66b5851df857 100644 --- a/command/agent/retry_join.go +++ b/command/agent/retry_join.go @@ -70,7 +70,7 @@ func (r *retryJoiner) Validate(config *Config) error { return fmt.Errorf("server_join and retry_max cannot both be defined; try defining only server_join") } if config.Server.RetryInterval != "0" { - return fmt.Errorf("server_join and retry_interval cannot both be defined; try defining only server_join") + return fmt.Errorf("server_join and retry_interval cannot both be defined; prefer setting the server_join parameter") } } diff --git a/website/source/docs/agent/configuration/client.html.md b/website/source/docs/agent/configuration/client.html.md index 4cb00e6c0b1f..7cee5601a59f 100644 --- a/website/source/docs/agent/configuration/client.html.md +++ b/website/source/docs/agent/configuration/client.html.md @@ -91,7 +91,10 @@ client { the port. If the port is omitted, the default port of `4647` is used. - `server_join` ([server_join](#server-join): nil) - Specifies - configuration which is specific to retry joining Nomad servers. + how the Nomad client will connect to Nomad servers. The `start_join` field + is not supported on the client. The retry_join fields may directly specify + the server address or use go-discover syntax for auto-discovery. See the + documentation for more detail. - `state_dir` `(string: "[data_dir]/client")` - Specifies the directory to use to store client state. By default, this is - the top-level diff --git a/website/source/docs/agent/configuration/server.html.md b/website/source/docs/agent/configuration/server.html.md index ede0a1677f2e..d1919872d117 100644 --- a/website/source/docs/agent/configuration/server.html.md +++ b/website/source/docs/agent/configuration/server.html.md @@ -136,7 +136,9 @@ server { rejoin the cluster. - `server_join` ([server_join](#server-join): nil) - Specifies - configuration for retry joining Nomad servers if the first attempt fails. + how the Nomad client will connect to Nomad servers. The retry_join fields may + directly specify the server address or use go-discover syntax for + auto-discovery. See the documentation for more detail. - `upgrade_version` `(string: "")` - A custom version of the format X.Y.Z to use in place of the Nomad version when custom upgrades are enabled in Autopilot. diff --git a/website/source/docs/agent/configuration/server_join.html.md b/website/source/docs/agent/configuration/server_join.html.md index eb65f62fdc24..4fa823e23560 100644 --- a/website/source/docs/agent/configuration/server_join.html.md +++ b/website/source/docs/agent/configuration/server_join.html.md @@ -107,7 +107,7 @@ nomad-01.company.local => nomad-01.company.local:4648 #### Via the go-discover interface -As of Nomad 0.8.4, `retry-join` accepts a unified interface using the +As of Nomad 0.8.4, `retry_join` accepts a unified interface using the [go-discover](https://github.com/hashicorp/go-discover) library for doing automated cluster joining using cloud metadata.