Sean Chittenden
e24de53ead
Refine Nomad's Consul `port` handling.
...
Previously this would immediately default to '127.0.0.1' if the
config was set to `:some-port-number`. Now it uses the BindAddr
if available. Also, if the `port` option is set to just a port`
number (e.g. '1234'), attempt to parse the port number by itself
to allow statically configured ports to work, even when no host is
specified.
2016-06-10 15:54:39 -04:00
Sean Chittenden
555f4fe135
Change client/consul.NewSyncer() to accept a shutdown channel
...
In addition to the API changing, consul.Syncer can now be signaled
to shutdown via the Shutdown() method, which will call the Run()'ing
sync task to exit gracefully.
2016-06-10 15:54:39 -04:00
Sean Chittenden
e2a561204a
Fix typo in comment
2016-06-10 15:50:11 -04:00
Sean Chittenden
f671dac6cc
Fix test TestClientConfigCommand_UpdateServers()
...
Now that hostnames are validated on input, switch to IPs since they
bypass DNS resolution.
2016-06-10 15:50:11 -04:00
Sean Chittenden
b199743b8a
Add some trace-level logging for /v1/agent/servers when writing
...
This endpoint shouldn't be hit often, but this could be useful in
logs down the road.
2016-06-10 15:50:11 -04:00
Sean Chittenden
07fa89d2a5
Fix config_parse_test to reflect that `consul.addr` does not exist.
...
`consul.address` does, but not `consul.addr`.
2016-06-10 15:50:11 -04:00
Sean Chittenden
7fe1944bc5
Fix tests for client.TestAgent_ServerConfig
...
Add similar logic in Agent `serverConfig()` to set up the
`serverSerfAddr` the same as `serverHttpAddr` and `serverRpcAddr`.
2016-06-10 15:50:11 -04:00
Sean Chittenden
39fb0f2469
Change the endpoint for `/v1/agent/servers` and fix tests.
...
When an agent is running a server, the list of servers includes the
Raft peers. When the agent is running a client (which is always the
case?), include a list of the servers found in the Client's RpcProxy.
Dedupe and provide a unique list back to the caller.
2016-06-10 15:50:11 -04:00
Sean Chittenden
cb80e93a6b
Move client.DefaultConfig() to client/config.DefaultConfig()
...
Resolves an import cycle in testing and is more appropriate because
the default should reside next to its struct definition.
2016-06-10 15:50:11 -04:00
Sean Chittenden
b3fd455b1f
Register the serf service with the Nomad server service.
...
This will be unused in this PR.
2016-06-10 15:50:11 -04:00
Sean Chittenden
82d537fbd9
Update the `nomad_server_service` default from `nomad-server` to just `nomad`.
2016-06-10 15:50:11 -04:00
Sean Chittenden
7c3838373b
Create a weak decoder to parse time.Duration.
...
Hat tip to Alex for pointing this out (vs patching mapstructure)
2016-06-10 15:50:11 -04:00
Sean Chittenden
6cd01d7567
Nuke a.consulConfig in favor of a.consul.Config
2016-06-10 15:50:11 -04:00
Sean Chittenden
1fe979a5e4
Remove types.ShutdownChannel and replace with `chan struct{}`
2016-06-10 15:50:11 -04:00
Sean Chittenden
9fb0104def
Teach Client to reuse an Agent's consulSyncer.
...
"There can be only one."
2016-06-10 15:50:11 -04:00
Sean Chittenden
47891fb559
Register two services each for clients and servers, http and rpc.
...
In order to give clients a fighting chance to talk to the right port,
differentiate RPC services from HTTP services by registering two
services with different tags. This yields
`rpc.nomad-server.service.consul` and
`http.nomad-server.service.consul` which is immensely more useful to
clients attempting to bootstrap their world.
2016-06-10 15:50:11 -04:00
Sean Chittenden
ac7881226c
Advertise the server's RPC endpoint, not its HTTP endpoint.
...
Rename c.serverRpcAddr to serverRpcAddr. This will be broken out
into in additional set of services in a subsequent commit.
2016-06-10 15:50:11 -04:00
Sean Chittenden
410d85cc78
Rename the package from `client/rpc_proxy` to `client/rpcproxy`
...
Also rename `NewRpcProxy()` to just `New()` to avoid package stutter.
2016-06-10 15:50:11 -04:00
Sean Chittenden
10d1b6ba9b
Reduce all forms of ConsulConfig down to a single struct
...
nomad/structs/config/consul.go's ConsulConfig is the canonical definition
for all things Consul now.
2016-06-10 15:50:11 -04:00
Sean Chittenden
520fcb99de
Rename consulConfig to consulAgentConfig
2016-06-10 15:50:11 -04:00
Sean Chittenden
e6c78274c8
Rename client/config/config's ConsulConfig to ConsulAgentConfig
...
A follow up commit to the previous rename. More to come.
2016-06-10 15:50:11 -04:00
Sean Chittenden
e727fd8c3c
Centralize the creation of a consul/api.Config struct.
...
While documented, the consul.timeout parameter wasn't ever set
except one-off in the Consul fingerprinter.
2016-06-10 15:50:11 -04:00
Sean Chittenden
f695d6d70d
Reconcile consul's address configuration section.
...
There were conflicting directives previously, both consul.addr and
consul.address were required to achieve the desired behavior. The
documentation said `consul.address` was the canonical name for the
parameter, so consolidate configuration parameters to `consul.address`.
2016-06-10 15:50:11 -04:00
Sean Chittenden
bd779c3719
Reconcile renamed structures during rebase
2016-06-10 15:50:11 -04:00
Sean Chittenden
882364f4d9
An Agent's consulSyncer is always not nil now.
2016-06-10 15:50:11 -04:00
Sean Chittenden
98cea9ba07
Revise Agent.syncAgentServicesWithConsul()'s interface
...
Reduce down to its lowest common helper function denominator.
2016-06-10 15:50:11 -04:00
Sean Chittenden
b5c70f3729
Alpha sort config keys for Consul
2016-06-10 15:50:11 -04:00
Sean Chittenden
d1442dc317
Reduce all forms of ConsulConfig down to a single struct
...
nomad/structs/config/consul.go's ConsulConfig is the canonical definition
for all things Consul now.
2016-06-10 15:50:11 -04:00
Sean Chittenden
e60580b279
Define a type for the PeriodicCallback handlers and ShutdownChannel
2016-06-10 15:50:11 -04:00
Sean Chittenden
17116fc5a7
Rebalance Nomad client RPCs among different Nomad servers.
...
Implement client/rpc_proxy.RpcProxy.
2016-06-10 15:50:11 -04:00
Sean Chittenden
88f3422d7c
Rename NewConsulService to NewSyncer
2016-06-10 15:49:37 -04:00
Sean Chittenden
b9789e0cf7
Rename client/consul/sync.PeriodicSync to Run
2016-06-10 15:49:37 -04:00
Sean Chittenden
768aab015d
Rename client/consul/sync.ConsulService to client/consul/sync.Syncer
...
Syncer describes the responsibility and actions of the type.
2016-06-10 15:49:37 -04:00
Sean Chittenden
b509da2d0c
Create a `nomad/structs/config` to break an import cycle.
...
Flattening and normalizing the various Consul config structures and
services has led to an import cycle. Break this by creating a new package
that is intended to be terminal in the import DAG.
2016-06-10 15:48:36 -04:00
Sean Chittenden
840b49a720
Distill config.Config.ConsulConfig down to config.Config.Consul
...
The enclosed struct provides the necessary context
2016-06-10 15:48:36 -04:00
Sean Chittenden
c7a680c28f
Rename consulConfig to consulAgentConfig
2016-06-10 15:48:36 -04:00
Sean Chittenden
73e173673e
Rename client/config/config's ConsulConfig to ConsulAgentConfig
...
A follow up commit to the previous rename. More to come.
2016-06-10 15:48:36 -04:00
Sean Chittenden
e97652bbfb
Rename consul.ConsulConfig to consul.AgentConfig
...
There were two `ConsulConfig` structs running around, one of them
needed to go away. Rely on the package's path to provide context
for the type of AgentConfig.
2016-06-10 15:48:36 -04:00
Sean Chittenden
e36686a17d
Use consul/lib's RandomStagger
...
Removes four redundant copies of the method in the process.
2016-06-10 15:48:36 -04:00
Alex Dadgar
b4fa34a854
Merge pull request #1252 from hashicorp/f-blocked-eval-text
...
Better placement failure text for blocked evals
2016-06-10 11:41:41 -07:00
Alex Dadgar
f006aeeb20
helper
2016-06-10 11:02:15 -07:00
Alex Dadgar
93a8af1422
better placement failure text for blocked evals
2016-06-10 10:56:32 -07:00
Alex Dadgar
3cf74e7fd8
Alloc-status only shows measured statistics and fixes to CPU calculations
2016-06-10 10:38:29 -07:00
Diptanu Choudhury
872957e015
Merge pull request #1246 from hashicorp/fix-node-cpu-usage
...
Changed the logic of calculation of node cpu usage
2016-06-09 19:29:12 -07:00
Diptanu Choudhury
ef2d630ea4
Changed the logic of calculation of node cpu usage
2016-06-10 03:24:42 +01:00
Alex Dadgar
2102855ae7
Merge pull request #1237 from hashicorp/b-regions
...
CLI can forward request to different regions
2016-06-08 11:00:23 -07:00
Diptanu Choudhury
66052700ca
Moving the stats error to the bottom of alloc status
2016-06-08 12:28:41 -04:00
Diptanu Choudhury
843d7e224e
Moving the stats error to the bottom of node status
2016-06-08 12:21:20 -04:00
Diptanu Choudhury
5074121e70
Fixed the formating of % in nomad alloc status
2016-06-08 08:53:33 -04:00
Alex Dadgar
77dd3af134
docs
2016-06-07 11:33:55 -07:00