Commit Graph

33 Commits

Author SHA1 Message Date
Sean Chittenden 917766a3df
Prefer `%+q` over `%q` in log messages. 2016-06-11 18:17:20 -04:00
Sean Chittenden bbd8dfa798
goling(1) compliance pass (e.g. Rpc* -> RPC) 2016-06-10 23:38:28 -04:00
Sean Chittenden d433001f04
Expose rpcproxy's `ServerEndpoint()` constructor, `newServer()` as `NewServerEndpoint()` 2016-06-10 22:14:03 -04:00
Sean Chittenden 5b0c2bf282
Restore old behavior and have AddPrimaryServer() return a pointer to the existing server (vs nil when the server already exists). 2016-06-10 16:46:49 -04:00
Sean Chittenden df896c6ef2
Prevent duplicate servers being added in AddPrimaryServer.
This logic was already present elsewhere and was missed in this one
place.
2016-06-10 15:55:27 -04:00
Sean Chittenden 03846fb754
Rename listLock to activatedListLock 2016-06-10 15:54:39 -04:00
Sean Chittenden 4c9067310b
Nomad does not use Serf at the client level. Use a hard lock. 2016-06-10 15:54:39 -04:00
Sean Chittenden 26b1e826d7
golint(1) police 2016-06-10 15:54:39 -04:00
Sean Chittenden 974c9927c7
Formatting nit: remove brackets 2016-06-10 15:54:39 -04:00
Sean Chittenden 1371ef85f5
Prefix all log entries in client/rpcproxy with client.rpcproxy 2016-06-10 15:54:39 -04:00
Sean Chittenden 009495c18a
Style nit: remove `var` block 2016-06-10 15:54:39 -04:00
Sean Chittenden 8dc16ad5e3
Move RPCProxy.New() adjacent to its struct definition 2016-06-10 15:54:39 -04:00
Sean Chittenden ed29946f5e
Populate the RPC Proxy's server list if heartbeat did not include a leader.
It's possible that a Nomad Client is heartbeating with a Nomad server that
has become issolated from the quorum of Nomad Servers.  When 3x the
heartbeatTTL has been exceeded, append the Consul server list to the primary
primary server list.  When the next RPCProxy rebalance occurs, there is a
chance one of the servers discovered from Consul will be in the majority.
When client reattaches to a Nomad Server in the majority, it will include
a heartbeat and will reset the TTLs *AND* will clear the primary server list
to include only values from the heartbeat.
2016-06-10 15:54:39 -04:00
Sean Chittenden 439baa0f8b
Remove named return parameters 2016-06-10 15:50:11 -04:00
Sean Chittenden ea0b35e303
Collapse server_endpoint_internal_test.go into server_endpoint_test.go
Requested by: @dadgar
2016-06-10 15:50:11 -04:00
Sean Chittenden 6e71bbc26b
Collapse rpcproxy_internal_test.go into rpcproxy_test.go
Requested by: @dadgar
2016-06-10 15:50:11 -04:00
Sean Chittenden 0d201631a3
Rename rpcproxy.UpdateFromNodeUpdateResponse to RefreshServerLists
While breaking the API within this PR, break out the individual
arguments to RefreshServerLists.  The servers parameter is reusing
`structs.NodeServerInfo` for the time being, but this can be revisited
if the needs of the strucutre diverge in the future.
2016-06-10 15:50:11 -04:00
Sean Chittenden a6a4345f27
Clean up various comments 2016-06-10 15:50:11 -04:00
Sean Chittenden 04c697c610
Update godoc for newServer to reflect DNS and IP-based inputs
Requested by: alex
2016-06-10 15:50:11 -04:00
Sean Chittenden 7167b7a357
Add a quick set of client/rpcproxy.ServerEndpoint equality tests 2016-06-10 15:50:11 -04:00
Sean Chittenden 3b5db4e390
Fix the client/rpcproxy unit tests. 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 d87085e040
Fix a comment to be more correct 2016-06-10 15:50:11 -04:00
Sean Chittenden bff57a0dce
Reconcile, clean up, and centralize API version numbers (major and minor).
Reduce future confusion by introducing a minor version that is gossiped out
via the `mvn` Serf tag (Minor Version Number, `vsn` is already being used for
to communicate `Major Version Number`).

Background: hashicorp/consul/issues/1346#issuecomment-151663152
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 6d9ec364e5
Change the constants used to match the struct definitions 2016-06-10 15:50:11 -04:00
Sean Chittenden c013957d49
When clearing the backup servers, set the length to zero. 2016-06-10 15:50:11 -04:00
Sean Chittenden 498f21cdec
Clear the backup server list when a Nomad heartbeat arives with servers
If Nomad is heartbeating during a transition from using backup servers
to Nomad servers, make Nomad the canonical source of servers and flush
the list of servers populated from Consul.
2016-06-10 15:50:11 -04:00
Sean Chittenden 438becb28b
Pass the datacenter name in the heartbeat
Servers that are part of a different datacenter are added as backup
servers instead of primary servers.
2016-06-10 15:50:11 -04:00
Sean Chittenden d2f9848348
Bump the cluster test minimums to 10min.
These ranges aren't too useful with the default 600s rebalance, but
will be useful if that default ever changes in the future.
2016-06-10 15:50:11 -04:00
Sean Chittenden bd0588ffa8
Bump shuffle interval per suggestion from Alex 2016-06-10 15:50:11 -04:00
Sean Chittenden 5570aa98e9
Fix package name in comments 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