Commit Graph

4179 Commits

Author SHA1 Message Date
Sean Chittenden
9998573298 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
ca0f2d982d Nuke a.consulConfig in favor of a.consul.Config 2016-06-10 15:50:11 -04:00
Sean Chittenden
9bd28824e0 Nuke trace-level logging in heartbeats 2016-06-10 15:50:11 -04:00
Sean Chittenden
49266fa29f Invert error handling logic 2016-06-10 15:50:11 -04:00
Sean Chittenden
3d22c22bf5 Remove types.ShutdownChannel and replace with chan struct{} 2016-06-10 15:50:11 -04:00
Sean Chittenden
57bb374236 Fix unit tests 2016-06-10 15:50:11 -04:00
Sean Chittenden
7034c50d2f 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
2abd37c741 Silence unused variable warning 2016-06-10 15:50:11 -04:00
Sean Chittenden
bccf131f9a Invert check definition so the error is first 2016-06-10 15:50:11 -04:00
Sean Chittenden
9a93496475 Consolidate all consul sync periodic go routines to handlers.
Only one pump and periodic loop now.
2016-06-10 15:50:11 -04:00
Sean Chittenden
4d47eedd58 Teach Client to reuse an Agent's consulSyncer.
"There can be only one."
2016-06-10 15:50:11 -04:00
Sean Chittenden
bc86e897ed 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
ce8c03d708 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
b293cf33c1 Fix typo in the comment to reflect the actual function name. 2016-06-10 15:50:11 -04:00
Sean Chittenden
916d93c9ab 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
1034e766a4 s/RpcVersion/RPCVersion/g 2016-06-10 15:50:11 -04:00
Sean Chittenden
1e3feae8f9 Bump shuffle interval per suggestion from Alex 2016-06-10 15:50:11 -04:00
Sean Chittenden
cbed88a808 Move struct member to reduce diff context 2016-06-10 15:50:11 -04:00
Sean Chittenden
0a5fa55e8f Fix package name in comments 2016-06-10 15:50:11 -04:00
Sean Chittenden
7cdf0edcfe 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
22bd2b5ef2 Rename manager_test.go to rpc_proxy_test.go 2016-06-10 15:50:11 -04:00
Sean Chittenden
a703c8a42f Rename RpcProxy's internal filename to match 2016-06-10 15:50:11 -04:00
Sean Chittenden
3728771060 Remove unused code 2016-06-10 15:50:11 -04:00
Sean Chittenden
1fa43a09dd 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
16b4e5c9be Rebalance Nomad client RPCs among different Nomad servers.
Implement client/rpc_proxy.RpcProxy.
2016-06-10 15:50:11 -04:00
Sean Chittenden
6fae3db12e Rename ConsulConfig to ConsulAgentConfig 2016-06-10 15:50:11 -04:00
Sean Chittenden
4d30c98aa6 Rename consulConfig to consulAgentConfig 2016-06-10 15:50:11 -04:00
Sean Chittenden
5e0d76f7ce 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
07fa0c58d4 Use the correctly typed rand.Int* variant 2016-06-10 15:50:11 -04:00
Sean Chittenden
990a094bed Use rand.Int*n() where appropriate 2016-06-10 15:50:11 -04:00
Sean Chittenden
e6397da738 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
bc94ce8aa6 Rename mergedNomadMap to mergedPrimaryMap. Gratuitous, but more correct. 2016-06-10 15:50:11 -04:00
Sean Chittenden
71dde1b584 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
7125b85744 Correct a mismerge
Somewhere along the lines when rebasing I mis-merged a patch.
2016-06-10 15:50:11 -04:00
Sean Chittenden
681a7d6930 Remove testing for an API that doesn't exist any more. 2016-06-10 15:50:11 -04:00
Sean Chittenden
90023c3639 Rename RpcProxy's internal filename to match 2016-06-10 15:50:11 -04:00
Sean Chittenden
05bbbd2d55 Reconcile renamed structures during rebase 2016-06-10 15:50:11 -04:00
Sean Chittenden
fc5658521c index on f-dyn-server-list: bd38cb4 Remove unused code 2016-06-10 15:50:11 -04:00
Sean Chittenden
4e4f0a1625 Remove unused code 2016-06-10 15:50:11 -04:00
Sean Chittenden
17927c8b9c Only poll Consul for servers when Nomad heartbeats begin to fail
When a deadline timer of 2x Server's last requested TTL expires,
begin polling Consul for Nomad Servers.
2016-06-10 15:50:11 -04:00
Sean Chittenden
c159e77fe3 An Agent's consulSyncer is always not nil now. 2016-06-10 15:50:11 -04:00
Sean Chittenden
89d48c8e82 Revise Agent.syncAgentServicesWithConsul()'s interface
Reduce down to its lowest common helper function denominator.
2016-06-10 15:50:11 -04:00
Sean Chittenden
8da18b60f3 Alpha sort config keys for Consul 2016-06-10 15:50:11 -04:00
Sean Chittenden
e07e77b79d s/availble/runChecks/g 2016-06-10 15:50:11 -04:00
Sean Chittenden
d268dcb85d 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
f6e3587321 Define a type for the PeriodicCallback handlers and ShutdownChannel 2016-06-10 15:50:11 -04:00
Sean Chittenden
ffcd2332d4 Rebalance Nomad client RPCs among different Nomad servers.
Implement client/rpc_proxy.RpcProxy.
2016-06-10 15:50:11 -04:00
Sean Chittenden
7c6ad53d89 Rename NewConsulService to NewSyncer 2016-06-10 15:49:37 -04:00
Sean Chittenden
f280c59633 Rename client/consul/sync.PeriodicSync to Run 2016-06-10 15:49:37 -04:00
Sean Chittenden
d84d71847c 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