diff --git a/command/agent/agent.go b/command/agent/agent.go index c01e0d857..6965cb2db 100644 --- a/command/agent/agent.go +++ b/command/agent/agent.go @@ -478,7 +478,7 @@ func (a *Agent) setupServer() error { Tags: []string{consul.ServiceTagRPC}, Checks: []*structs.ServiceCheck{ { - Name: a.config.Consul.ServerRPCHealthCheckName, + Name: a.config.Consul.ServerRPCCheckName, Type: "tcp", Interval: serverRpcCheckInterval, Timeout: serverRpcCheckTimeout, @@ -492,7 +492,7 @@ func (a *Agent) setupServer() error { Tags: []string{consul.ServiceTagSerf}, Checks: []*structs.ServiceCheck{ { - Name: a.config.Consul.ServerSerfHealthCheckName, + Name: a.config.Consul.ServerSerfCheckName, Type: "tcp", Interval: serverSerfCheckInterval, Timeout: serverSerfCheckTimeout, @@ -592,7 +592,7 @@ func (a *Agent) agentHTTPCheck(server bool) *structs.ServiceCheck { httpCheckAddr = a.config.AdvertiseAddrs.HTTP } check := structs.ServiceCheck{ - Name: a.config.Consul.ClientHTTPHealthCheckName, + Name: a.config.Consul.ClientHTTPCheckName, Type: "http", Path: "/v1/agent/health?type=client", Protocol: "http", @@ -602,7 +602,7 @@ func (a *Agent) agentHTTPCheck(server bool) *structs.ServiceCheck { } // Switch to endpoint that doesn't require a leader for servers if server { - check.Name = a.config.Consul.ServerHTTPHealthCheckName + check.Name = a.config.Consul.ServerHTTPCheckName check.Path = "/v1/agent/health?type=server" } if !a.config.TLSConfig.EnableHTTP { diff --git a/command/agent/command.go b/command/agent/command.go index dcf4b0ccb..91c44f8c4 100644 --- a/command/agent/command.go +++ b/command/agent/command.go @@ -120,12 +120,12 @@ func (c *Command) readConfig() *Config { return nil }), "consul-client-auto-join", "") flags.StringVar(&cmdConfig.Consul.ClientServiceName, "consul-client-service-name", "", "") - flags.StringVar(&cmdConfig.Consul.ClientHTTPHealthCheckName, "consul-client-http-health-check-name", "", "") + flags.StringVar(&cmdConfig.Consul.ClientHTTPCheckName, "consul-client-http-check-name", "", "") flags.StringVar(&cmdConfig.Consul.KeyFile, "consul-key-file", "", "") flags.StringVar(&cmdConfig.Consul.ServerServiceName, "consul-server-service-name", "", "") - flags.StringVar(&cmdConfig.Consul.ServerHTTPHealthCheckName, "consul-server-http-health-check-name", "", "") - flags.StringVar(&cmdConfig.Consul.ServerSerfHealthCheckName, "consul-server-serf-health-check-name", "", "") - flags.StringVar(&cmdConfig.Consul.ServerRPCHealthCheckName, "consul-server-rpc-health-check-name", "", "") + flags.StringVar(&cmdConfig.Consul.ServerHTTPCheckName, "consul-server-http-check-name", "", "") + flags.StringVar(&cmdConfig.Consul.ServerSerfCheckName, "consul-server-serf-check-name", "", "") + flags.StringVar(&cmdConfig.Consul.ServerRPCCheckName, "consul-server-rpc-check-name", "", "") flags.Var((flaghelper.FuncBoolVar)(func(b bool) error { cmdConfig.Consul.ServerAutoJoin = &b return nil @@ -1031,7 +1031,7 @@ Consul Options: -consul-client-service-name= Specifies the name of the service in Consul for the Nomad clients. - -consul-client-http-health-check-name= + -consul-client-http-check-name= Specifies the HTTP health check name in Consul for the Nomad clients. -consul-key-file= @@ -1041,13 +1041,13 @@ Consul Options: -consul-server-service-name= Specifies the name of the service in Consul for the Nomad servers. - -consul-server-http-health-check-name= + -consul-server-http-check-name= Specifies the HTTP health check name in Consul for the Nomad servers. - -consul-server-serf-health-check-name= + -consul-server-serf-check-name= Specifies the Serf health check name in Consul for the Nomad servers. - -consul-server-rpc-health-check-name= + -consul-server-rpc-check-name= Specifies the RPC health check name in Consul for the Nomad servers. -consul-server-auto-join diff --git a/command/agent/config-test-fixtures/basic.hcl b/command/agent/config-test-fixtures/basic.hcl index 9c8ebc66d..0c83ae95f 100644 --- a/command/agent/config-test-fixtures/basic.hcl +++ b/command/agent/config-test-fixtures/basic.hcl @@ -115,11 +115,11 @@ http_api_response_headers { } consul { server_service_name = "nomad" - server_http_health_check_name = "nomad-server-http-health-check" - server_serf_health_check_name = "nomad-server-serf-health-check" - server_rpc_health_check_name = "nomad-server-rpc-health-check" + server_http_check_name = "nomad-server-http-health-check" + server_serf_check_name = "nomad-server-serf-health-check" + server_rpc_check_name = "nomad-server-rpc-health-check" client_service_name = "nomad-client" - client_http_health_check_name = "nomad-client-http-health-check" + client_http_check_name = "nomad-client-http-health-check" address = "127.0.0.1:9500" token = "token1" auth = "username:pass" diff --git a/command/agent/config_parse.go b/command/agent/config_parse.go index 5be8042bb..17b96fa51 100644 --- a/command/agent/config_parse.go +++ b/command/agent/config_parse.go @@ -702,13 +702,13 @@ func parseConsulConfig(result **config.ConsulConfig, list *ast.ObjectList) error "checks_use_advertise", "client_auto_join", "client_service_name", - "client_http_health_check_name", + "client_http_check_name", "key_file", "server_auto_join", "server_service_name", - "server_http_health_check_name", - "server_serf_health_check_name", - "server_rpc_health_check_name", + "server_http_check_name", + "server_serf_check_name", + "server_rpc_check_name", "ssl", "timeout", "token", diff --git a/command/agent/config_parse_test.go b/command/agent/config_parse_test.go index 7a17cdf0d..5441e0cbc 100644 --- a/command/agent/config_parse_test.go +++ b/command/agent/config_parse_test.go @@ -134,24 +134,24 @@ func TestConfig_Parse(t *testing.T) { DisableUpdateCheck: true, DisableAnonymousSignature: true, Consul: &config.ConsulConfig{ - ServerServiceName: "nomad", - ServerHTTPHealthCheckName: "nomad-server-http-health-check", - ServerSerfHealthCheckName: "nomad-server-serf-health-check", - ServerRPCHealthCheckName: "nomad-server-rpc-health-check", - ClientServiceName: "nomad-client", - ClientHTTPHealthCheckName: "nomad-client-http-health-check", - Addr: "127.0.0.1:9500", - Token: "token1", - Auth: "username:pass", - EnableSSL: &trueValue, - VerifySSL: &trueValue, - CAFile: "/path/to/ca/file", - CertFile: "/path/to/cert/file", - KeyFile: "/path/to/key/file", - ServerAutoJoin: &trueValue, - ClientAutoJoin: &trueValue, - AutoAdvertise: &trueValue, - ChecksUseAdvertise: &trueValue, + ServerServiceName: "nomad", + ServerHTTPCheckName: "nomad-server-http-health-check", + ServerSerfCheckName: "nomad-server-serf-health-check", + ServerRPCCheckName: "nomad-server-rpc-health-check", + ClientServiceName: "nomad-client", + ClientHTTPCheckName: "nomad-client-http-health-check", + Addr: "127.0.0.1:9500", + Token: "token1", + Auth: "username:pass", + EnableSSL: &trueValue, + VerifySSL: &trueValue, + CAFile: "/path/to/ca/file", + CertFile: "/path/to/cert/file", + KeyFile: "/path/to/key/file", + ServerAutoJoin: &trueValue, + ClientAutoJoin: &trueValue, + AutoAdvertise: &trueValue, + ChecksUseAdvertise: &trueValue, }, Vault: &config.VaultConfig{ Addr: "127.0.0.1:9500", diff --git a/nomad/structs/config/consul.go b/nomad/structs/config/consul.go index 5bbc35e1b..9473ea814 100644 --- a/nomad/structs/config/consul.go +++ b/nomad/structs/config/consul.go @@ -23,25 +23,25 @@ type ConsulConfig struct { // servers with Consul ServerServiceName string `mapstructure:"server_service_name"` - // ServerHTTPHealthCheckName is the name of the health check that Nomad uses + // ServerHTTPCheckName is the name of the health check that Nomad uses // to register the server HTTP health check with Consul - ServerHTTPHealthCheckName string `mapstructure:"server_http_health_check_name"` + ServerHTTPCheckName string `mapstructure:"server_http_check_name"` - // ServerSerfHealthCheckName is the name of the health check that Nomad uses + // ServerSerfCheckName is the name of the health check that Nomad uses // to register the server Serf health check with Consul - ServerSerfHealthCheckName string `mapstructure:"server_serf_health_check_name"` + ServerSerfCheckName string `mapstructure:"server_serf_check_name"` - // ServerSerfHealthCheckName is the name of the health check that Nomad uses + // ServerRPCCheckName is the name of the health check that Nomad uses // to register the server RPC health check with Consul - ServerRPCHealthCheckName string `mapstructure:"server_rpc_health_check_name"` + ServerRPCCheckName string `mapstructure:"server_rpc_check_name"` // ClientServiceName is the name of the service that Nomad uses to register // clients with Consul ClientServiceName string `mapstructure:"client_service_name"` - // ClientHTTPHealthCheckName is the name of the health check that Nomad uses + // ClientHTTPCheckName is the name of the health check that Nomad uses // to register the client HTTP health check with Consul - ClientHTTPHealthCheckName string `mapstructure:"client_http_health_check_name"` + ClientHTTPCheckName string `mapstructure:"client_http_check_name"` // AutoAdvertise determines if this Nomad Agent will advertise its // services via Consul. When true, Nomad Agent will register @@ -94,19 +94,19 @@ type ConsulConfig struct { // `consul` configuration. func DefaultConsulConfig() *ConsulConfig { return &ConsulConfig{ - ServerServiceName: "nomad", - ServerHTTPHealthCheckName: "Nomad Server HTTP Check", - ServerSerfHealthCheckName: "Nomad Server Serf Check", - ServerRPCHealthCheckName: "Nomad Server RPC Check", - ClientServiceName: "nomad-client", - ClientHTTPHealthCheckName: "Nomad Client HTTP Check", - AutoAdvertise: helper.BoolToPtr(true), - ChecksUseAdvertise: helper.BoolToPtr(false), - EnableSSL: helper.BoolToPtr(false), - VerifySSL: helper.BoolToPtr(true), - ServerAutoJoin: helper.BoolToPtr(true), - ClientAutoJoin: helper.BoolToPtr(true), - Timeout: 5 * time.Second, + ServerServiceName: "nomad", + ServerHTTPCheckName: "Nomad Server HTTP Check", + ServerSerfCheckName: "Nomad Server Serf Check", + ServerRPCCheckName: "Nomad Server RPC Check", + ClientServiceName: "nomad-client", + ClientHTTPCheckName: "Nomad Client HTTP Check", + AutoAdvertise: helper.BoolToPtr(true), + ChecksUseAdvertise: helper.BoolToPtr(false), + EnableSSL: helper.BoolToPtr(false), + VerifySSL: helper.BoolToPtr(true), + ServerAutoJoin: helper.BoolToPtr(true), + ClientAutoJoin: helper.BoolToPtr(true), + Timeout: 5 * time.Second, } } @@ -117,20 +117,20 @@ func (a *ConsulConfig) Merge(b *ConsulConfig) *ConsulConfig { if b.ServerServiceName != "" { result.ServerServiceName = b.ServerServiceName } - if b.ServerHTTPHealthCheckName != "" { - result.ServerHTTPHealthCheckName = b.ServerHTTPHealthCheckName + if b.ServerHTTPCheckName != "" { + result.ServerHTTPCheckName = b.ServerHTTPCheckName } - if b.ServerSerfHealthCheckName != "" { - result.ServerSerfHealthCheckName = b.ServerSerfHealthCheckName + if b.ServerSerfCheckName != "" { + result.ServerSerfCheckName = b.ServerSerfCheckName } - if b.ServerRPCHealthCheckName != "" { - result.ServerRPCHealthCheckName = b.ServerRPCHealthCheckName + if b.ServerRPCCheckName != "" { + result.ServerRPCCheckName = b.ServerRPCCheckName } if b.ClientServiceName != "" { result.ClientServiceName = b.ClientServiceName } - if b.ClientHTTPHealthCheckName != "" { - result.ClientHTTPHealthCheckName = b.ClientHTTPHealthCheckName + if b.ClientHTTPCheckName != "" { + result.ClientHTTPCheckName = b.ClientHTTPCheckName } if b.AutoAdvertise != nil { result.AutoAdvertise = helper.BoolToPtr(*b.AutoAdvertise)