Commit Graph

365 Commits

Author SHA1 Message Date
Cameron Davison
d866002f82 fix setup consul syncer error message 2016-07-28 22:14:52 -05:00
Alex Dadgar
cb84b61bfa Node.Register handles the case of transistioning to ready and creating evals 2016-07-21 15:22:02 -07:00
Diptanu Choudhury
5e4d6e1c46 Fixed a debug message 2016-07-09 00:12:53 -07:00
Sean Chittenden
762973e15f Consolidate fingerprinters into a single map. 2016-07-08 23:37:14 -07:00
Sean Chittenden
7f33b7d417 Code golf
Pointed out by: @dadgar
2016-06-21 14:26:01 -07:00
Sean Chittenden
cc1c73fd51 Fix the shuffling of remote datacenters.
Pointed out by: @ryanuber
2016-06-21 13:37:22 -07:00
Sean Chittenden
bcf0929c95 Pass a logger arg to NewClient and NewServer 2016-06-16 23:29:23 -07:00
Sean Chittenden
53ffd40bef Only register the Client services reaper when consul.auto_advertise is enabled 2016-06-16 18:24:58 -07:00
Sean Chittenden
5559e013bf Only auto-join clients if client_auto_join is true 2016-06-16 14:47:21 -07:00
Sean Chittenden
5708560527 Merge pull request #1276 from hashicorp/f-consul-server-autojoin
Teach Nomad servers how to fall back to Consul.
2016-06-16 14:40:45 -07:00
Sean Chittenden
a915cdc337 Use the %+q verb in log messages (vs %q). 2016-06-16 11:03:51 -07:00
Alex Dadgar
ee240d5162 remove trace 2016-06-15 15:47:59 -07:00
Sean Chittenden
d7a0401d72 Shuffle all datacenters vs only the nearest N datacenters.
Per discussion, we want to be aggressive about fanning out vs possibly
fixating on only local DCs.  With RPC forwarding in place, a random walk
may be less optimal from a network latency perspective, but it is guaranteed
to eventually result in a converged state because all DCs are candidates
during the bootstrapping process.
2016-06-15 12:40:51 -07:00
Sean Chittenden
972b4fb3bc Bump various Consul search limits
Client: Search limit increased from 4 random DCs to 8 random DCs, plus nearest.
Server: Search factor increased from 3 to 5 times the bootstrap_expect.

This should allow for faster convergence in large environments (e.g.
sub-5min for 10K Consul DCs).
2016-06-15 12:40:51 -07:00
Alex Dadgar
73d565aabc Use Status.Peers instead of Status.Ping 2016-06-15 12:00:20 -07:00
Alex Dadgar
f320b5a76f address comments 2016-06-13 17:32:18 -07:00
Alex Dadgar
1e4ec6b2b3 Fix IDs and domain scoping 2016-06-13 16:30:58 -07:00
Diptanu Choudhury
02b320c81e implemented reconciliation of unwanted services 2016-06-13 14:52:26 +02:00
Alex Dadgar
b1351a3564 Do not reconcile in client and cleanup executor a bit 2016-06-12 18:22:07 -07:00
Alex Dadgar
c5059fc7c4 Rename ConsulService back to Service 2016-06-12 16:36:49 -07:00
Alex Dadgar
020f8b05d3 only support latest and remove ring buffer 2016-06-12 09:32:38 -07:00
Alex Dadgar
1a7df4e7d2 Allocation resources returned in a struct 2016-06-11 21:04:10 -07:00
Sean Chittenden
9b6e720fbe Merge pull request #1201 from hashicorp/f-dyn-server-list
Dynamic Server Lists/Client Bootstrapping via consul.
2016-06-11 18:58:25 -04:00
Sean Chittenden
006d1a3290 Walk the DCs from nearest to most remote. 2016-06-11 18:52:21 -04:00
Sean Chittenden
8d0b798f1d Walk the DCs from nearest to most remote, no limit on the search. 2016-06-11 18:23:06 -04:00
Sean Chittenden
a8b53b05b4 Prefer %+q over %q in log messages. 2016-06-11 18:17:20 -04:00
Diptanu Choudhury
6db40283fe Emitting client resource usage metrics as guages instead of k/v pairs 2016-06-11 22:17:32 +02:00
Sean Chittenden
5331ea7bc6 goling(1) compliance pass (e.g. Rpc* -> RPC) 2016-06-10 23:38:28 -04:00
Sean Chittenden
6819f2b68d Query for the Nomad service across multiple Consul datacenters. 2016-06-10 23:05:14 -04:00
Sean Chittenden
dbdebcad80 golint(1) police 2016-06-10 15:54:39 -04:00
Sean Chittenden
4b5310ea68 Properly guard consulPullHeartbeatDeadline behind heartbeatLock 2016-06-10 15:54:39 -04:00
Sean Chittenden
d2dcf27b35 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
d1ab21f2f7 Generate and sync Consul ServiceIDs consistently 2016-06-10 15:54:39 -04:00
Sean Chittenden
54838b9eba Rename structs.Task's Service attribute to ConsulService 2016-06-10 15:54:39 -04:00
Sean Chittenden
57c2c819e8 Move package client/consul/sync to command/agent/consul.
This has been done to allow the Server and Client to reuse the same
Syncer because the Agent may be running Client, Server, or both
simultaneously and we only want one Syncer object alive in the agent.
2016-06-10 15:54:39 -04:00
Sean Chittenden
cf8beb7ba9 Change the signature of the PeriodicCallback to return an error
I *KNEW* I should have done this when I wrote it, but didn't want to
go back and audit the handlers to include the appropriate return
handling, but now that the code is taking shape, make this change.
2016-06-10 15:54:39 -04:00
Sean Chittenden
1352f7f0e6 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
998f285be0 Ensure that all accesses to Client.alloc are wrapped by allocLock. 2016-06-10 15:50:11 -04:00
Sean Chittenden
8bbd763740 Use client.getAllocRunners() where appropriate. 2016-06-10 15:50:11 -04:00
Sean Chittenden
cf052e5f29 Line wrap long line. 2016-06-10 15:50:11 -04:00
Sean Chittenden
1ec537450e 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
f0c6b70911 Fix up the comments
Pointed out by: @dadgar
2016-06-10 15:50:11 -04:00
Sean Chittenden
8d478b96f7 Make the locking protocol more explicit in client.NewClient
With an over abundance of caution, preevnt future copy/pasta by
using the right locks when bootstrapping a Client.  Strictly speaking
this is not necessary, but it makes explicit the locking semantics
and guards against future concurrent or parallel initialization.
2016-06-10 15:50:11 -04:00
Sean Chittenden
8dd833f9a8 Use the client configCopy and lock appropriately. 2016-06-10 15:50:11 -04:00
Sean Chittenden
c8b2f7ce33 Flesh out the comment re: the client.rpcproxy.Run() task.
Requested by: Alex
2016-06-10 15:50:11 -04:00
Sean Chittenden
73c15603a9 Rename backupServerDeadline to consulPullHeartbeatDeadline
Suggested by: @alex
2016-06-10 15:50:11 -04:00
Sean Chittenden
4300cb31d9 Remove unused variable 2016-06-10 15:50:11 -04:00
Sean Chittenden
41904f262f Clean up some docs and comments to be more accurate 2016-06-10 15:50:11 -04:00
Sean Chittenden
445386bb3f Remove unused constants 2016-06-10 15:50:11 -04:00
Sean Chittenden
ed30876186 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