update server_join naming and improve logging
This commit is contained in:
parent
818b177220
commit
a4e514e07f
|
@ -558,8 +558,7 @@ func (c *Command) Run(args []string) int {
|
|||
serverEnabled: true,
|
||||
}
|
||||
|
||||
// This is for backwards compatibility, this should be removed in Nomad
|
||||
// 0.10 and only ServerJoin should be declared on the server
|
||||
// COMPAT: Remove in 0.10 and only use ServerJoin
|
||||
serverJoinInfo := &ServerJoin{
|
||||
RetryJoin: config.Server.RetryJoin,
|
||||
StartJoin: config.Server.StartJoin,
|
||||
|
|
|
@ -30,9 +30,8 @@ client {
|
|||
foo = "bar"
|
||||
baz = "zip"
|
||||
}
|
||||
server_join_info {
|
||||
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"
|
||||
}
|
||||
|
@ -94,7 +93,7 @@ server {
|
|||
redundancy_zone = "foo"
|
||||
upgrade_version = "0.8.0"
|
||||
encrypt = "abc"
|
||||
server_join_info {
|
||||
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
|
||||
|
|
|
@ -219,7 +219,7 @@ type ClientConfig struct {
|
|||
NoHostUUID *bool `mapstructure:"no_host_uuid"`
|
||||
|
||||
// ServerJoin contains information that is used to attempt to join servers
|
||||
ServerJoin *ServerJoin `mapstructure:"server_join_info"`
|
||||
ServerJoin *ServerJoin `mapstructure:"server_join"`
|
||||
}
|
||||
|
||||
// ACLConfig is configuration specific to the ACL system
|
||||
|
@ -355,7 +355,7 @@ type ServerConfig struct {
|
|||
EncryptKey string `mapstructure:"encrypt" json:"-"`
|
||||
|
||||
// ServerJoin contains information that is used to attempt to join servers
|
||||
ServerJoin *ServerJoin `mapstructure:"server_join_info"`
|
||||
ServerJoin *ServerJoin `mapstructure:"server_join"`
|
||||
}
|
||||
|
||||
// ServerJoin is used in both clients and servers to bootstrap connections to
|
||||
|
|
|
@ -370,7 +370,7 @@ func parseClient(result **ClientConfig, list *ast.ObjectList) error {
|
|||
"gc_parallel_destroys",
|
||||
"gc_max_allocs",
|
||||
"no_host_uuid",
|
||||
"server_join_info",
|
||||
"server_join",
|
||||
}
|
||||
if err := helper.CheckHCLKeys(listVal, valid); err != nil {
|
||||
return err
|
||||
|
@ -386,7 +386,7 @@ func parseClient(result **ClientConfig, list *ast.ObjectList) error {
|
|||
delete(m, "chroot_env")
|
||||
delete(m, "reserved")
|
||||
delete(m, "stats")
|
||||
delete(m, "server_join_info")
|
||||
delete(m, "server_join")
|
||||
|
||||
var config ClientConfig
|
||||
dec, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
|
||||
|
@ -451,9 +451,9 @@ func parseClient(result **ClientConfig, list *ast.ObjectList) error {
|
|||
}
|
||||
|
||||
// Parse ServerJoin config
|
||||
if o := listVal.Filter("server_join_info"); len(o.Items) > 0 {
|
||||
if o := listVal.Filter("server_join"); len(o.Items) > 0 {
|
||||
if err := parseServerJoin(&config.ServerJoin, o); err != nil {
|
||||
return multierror.Prefix(err, "server_join_info->")
|
||||
return multierror.Prefix(err, "server_join->")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -547,7 +547,7 @@ func parseServer(result **ServerConfig, list *ast.ObjectList) error {
|
|||
"redundancy_zone",
|
||||
"upgrade_version",
|
||||
|
||||
"server_join_info",
|
||||
"server_join",
|
||||
|
||||
// For backwards compatibility
|
||||
"start_join",
|
||||
|
@ -564,7 +564,7 @@ func parseServer(result **ServerConfig, list *ast.ObjectList) error {
|
|||
return err
|
||||
}
|
||||
|
||||
delete(m, "server_join_info")
|
||||
delete(m, "server_join")
|
||||
|
||||
var config ServerConfig
|
||||
dec, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
|
||||
|
@ -586,9 +586,9 @@ func parseServer(result **ServerConfig, list *ast.ObjectList) error {
|
|||
}
|
||||
|
||||
// Parse ServerJoin config
|
||||
if o := listVal.Filter("server_join_info"); len(o.Items) > 0 {
|
||||
if o := listVal.Filter("server_join"); len(o.Items) > 0 {
|
||||
if err := parseServerJoin(&config.ServerJoin, o); err != nil {
|
||||
return multierror.Prefix(err, "server_join_info->")
|
||||
return multierror.Prefix(err, "server_join->")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -599,7 +599,7 @@ func parseServer(result **ServerConfig, list *ast.ObjectList) error {
|
|||
func parseServerJoin(result **ServerJoin, list *ast.ObjectList) error {
|
||||
list = list.Elem()
|
||||
if len(list.Items) > 1 {
|
||||
return fmt.Errorf("only one 'server_info_join' block allowed")
|
||||
return fmt.Errorf("only one 'server_join' block allowed")
|
||||
}
|
||||
|
||||
// Get our object
|
||||
|
|
|
@ -49,7 +49,6 @@ func TestConfig_Parse(t *testing.T) {
|
|||
NodeClass: "linux-medium-64bit",
|
||||
ServerJoin: &ServerJoin{
|
||||
RetryJoin: []string{"1.1.1.1", "2.2.2.2"},
|
||||
StartJoin: []string{"1.1.1.1", "2.2.2.2"},
|
||||
RetryInterval: "15s",
|
||||
RetryMaxAttempts: 3,
|
||||
},
|
||||
|
|
|
@ -85,14 +85,14 @@ func (r *retryJoiner) RetryJoin(serverJoin *ServerJoin) {
|
|||
if r.serverEnabled && r.serverJoin != nil {
|
||||
n, err := r.serverJoin(addrs)
|
||||
if err == nil {
|
||||
r.logger.Printf("[INFO] agent: Join completed. Synced with %d initial agents", n)
|
||||
r.logger.Printf("[INFO] agent: Join completed. Server synced with %d initial servers", n)
|
||||
return
|
||||
}
|
||||
}
|
||||
if r.clientEnabled && r.clientJoin != nil {
|
||||
n, err := r.clientJoin(addrs)
|
||||
if err == nil {
|
||||
r.logger.Printf("[INFO] agent: Join completed. Synced with %d initial agents", n)
|
||||
r.logger.Printf("[INFO] agent: Join completed. Client synced with %d initial servers", n)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ func TestRetryJoin_Integration(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestRetryJoin_NonCloud(t *testing.T) {
|
||||
func TestRetryJoin_Server_NonCloud(t *testing.T) {
|
||||
t.Parallel()
|
||||
require := require.New(t)
|
||||
|
||||
|
@ -108,7 +108,7 @@ func TestRetryJoin_NonCloud(t *testing.T) {
|
|||
require.Equal(stubAddress, output[0])
|
||||
}
|
||||
|
||||
func TestRetryJoin_Cloud(t *testing.T) {
|
||||
func TestRetryJoin_Server_Cloud(t *testing.T) {
|
||||
t.Parallel()
|
||||
require := require.New(t)
|
||||
|
||||
|
@ -140,7 +140,7 @@ func TestRetryJoin_Cloud(t *testing.T) {
|
|||
require.Equal(stubAddress, output[0])
|
||||
}
|
||||
|
||||
func TestRetryJoin_MixedProvider(t *testing.T) {
|
||||
func TestRetryJoin_Server_MixedProvider(t *testing.T) {
|
||||
t.Parallel()
|
||||
require := require.New(t)
|
||||
|
||||
|
|
Loading…
Reference in New Issue