Commit Graph

1310 Commits

Author SHA1 Message Date
Wim 7c8f25c36e Fix ipv6 join failure 2017-04-06 23:27:39 +02:00
Kyle Havlovitz 4743895f40
Prefix autopilot log messages with 'autopilot' 2017-04-04 17:21:49 -07:00
Kyle Havlovitz a7fca8d6a7
Use voter count instead of server count for required quorum 2017-04-04 15:42:17 -07:00
James Phillips 76fdd5f392
Moves operator sub-functions into their own files. 2017-03-30 12:35:50 -07:00
Kyle Havlovitz 074b8576a5 Merge pull request #2847 from hashicorp/remove-peer-by-id
Add CLI/API endpoints for removing peer by ID
2017-03-30 10:13:56 -07:00
Kyle Havlovitz a2058d23ef
Add CLI/API endpoints for removing peer by ID 2017-03-30 10:13:32 -07:00
James Phillips 52651469dc
Bans check updates for nodes other than top-level reg. updates. 2017-03-29 16:17:58 -07:00
Kyle Havlovitz 35556a0eaf
Remove stale raft servers differently depending on minRaftVersion 2017-03-29 13:38:40 -07:00
Kyle Havlovitz 18c95b504a
Clean up raft servers without a corresponding serf entry 2017-03-29 12:52:00 -07:00
Kyle Havlovitz c7c2ebaf24
Use the new raft api function for leaving if applicable 2017-03-27 12:31:38 -07:00
James Phillips 424d70ba5d
Cleans up a stray mark and fixes unit tests.
Ended up removing the leader_test.go server address change test as part
of this. The join was failing becase we were using a new node name with
the new logic here, but realized this was hitting some of the memberlist
conflict logic and not working as we expected. We need some additional
work to fully support address changes, so removed the test for now.
2017-03-27 01:28:54 -07:00
James Phillips 97e761f50f
Adds node ID integrity checking for cluster merges. 2017-03-27 00:15:42 -07:00
James Phillips 7340b5b7ad
Adds node ID integrity checking for the catalog. 2017-03-27 00:15:21 -07:00
James Phillips a22c04f1bf
Gets rid of the Consul service exception under version 8.
Fixes #2816.
2017-03-24 12:12:24 -07:00
James Phillips 56b55b743f
Makes the start/stop test less flaky. 2017-03-23 20:04:23 -07:00
James Phillips 44a73bea7e
Fixes up some new tests for the updated testutil. 2017-03-23 17:55:47 -07:00
Seth Vargo dc47ebb082
Fix vet issues 2017-03-23 20:29:31 -04:00
Seth Vargo fe4c8b3a00 Merge pull request #2824 from hashicorp/sethvargo/testutil
Reduce coupling with testing.T
2017-03-23 20:29:11 -04:00
Seth Vargo 2efa3bdff8
Use new APIs 2017-03-23 18:48:13 -04:00
James Phillips 582e6c5938
Fixes an issue where servers would delete catalog information set by
the node when they were trying to reconcile a member.
2017-03-23 15:01:46 -07:00
James Phillips 16a9f6d671
Modifies server reconcile path to not use the server's token for internal operations. 2017-03-23 13:34:30 -07:00
Kyle Havlovitz 37ea20cb44
Add advanced autopilot features 2017-03-22 15:25:16 -07:00
James Phillips 36a0abe10f Merge pull request #2801 from hashicorp/spoken-hub-oss
Adds support for WAN soft fail and join flooding.
2017-03-20 16:24:07 -07:00
James Phillips d68bd9cca0
Cleans up based on review feedback. 2017-03-20 16:23:40 -07:00
James Phillips 898b26524a
Adds a warning if the context is canceled. 2017-03-20 09:27:28 -07:00
James Phillips 5ee1256137
Converts the stats fetch from serial to parallel and snaps the last index. 2017-03-19 20:48:42 -07:00
James Phillips cfc01419c8
Adds a stats fetcher to make sure we don't block the autopilot loop. 2017-03-17 18:42:28 -07:00
James Phillips e49d5456aa
Lowers log spam from the join flooder. 2017-03-16 23:38:15 -07:00
James Phillips 44d3e207ed
Makes the flood goroutine more reusable. 2017-03-16 16:42:19 -07:00
James Phillips 9176e77111
Shuts down flooder when either Serf is shut down. 2017-03-16 16:42:19 -07:00
James Phillips 0cf9cf22ad
Fixes a unit test that needed to account for WAN flooding. 2017-03-16 16:42:19 -07:00
James Phillips 91a861337b
Adds LAN -> WAN join flooding. 2017-03-16 16:42:19 -07:00
James Phillips 1e5a442420
Walks back the changes to change pool address interface into strings. 2017-03-16 16:42:19 -07:00
James Phillips dec485145e
Adds a hook for the route lookup function. 2017-03-16 16:42:19 -07:00
James Phillips ad39f8a0f6
Cleans up some small things based on review feedback. 2017-03-16 16:42:19 -07:00
James Phillips 543389ad0a
Adds offline detection. 2017-03-16 16:42:19 -07:00
James Phillips 8cc06ec10d
Adds missing unit tests and cleans up some router bugs. 2017-03-16 16:42:19 -07:00
James Phillips 850ac50e99
Makes the raft_vsn optional in Serf tags to support older servers. 2017-03-16 16:42:19 -07:00
James Phillips 1cd3a8a107
Simplifies median calculation. 2017-03-16 16:42:19 -07:00
James Phillips 28f8aa5559
Removes remoteConsuls in favor of the new router.
This has the next wave of RTT integration with the router and also
factors some common RTT-related helpers out to lib. While we were
in here we also got rid of the coordinate disable config so we don't
need to deal with the complexity in the router (there was never a
user-visible way to disable coordinates).
2017-03-16 16:42:19 -07:00
James Phillips 746e735dce
Fixes snapshot endpoint after merge. 2017-03-16 16:42:18 -07:00
James Phillips 0269bd0e41
Cleans up after merge. 2017-03-16 16:42:18 -07:00
James Phillips 82b6fbd844
Adds router into RPC paths with work in progress on coordinates. 2017-03-16 16:42:18 -07:00
James Phillips ef642c21b3
Adds an area request type. 2017-03-16 16:42:18 -07:00
James Phillips 838d85b7ae
Changes pool's dial address to a string and adds a timeout. 2017-03-16 16:42:18 -07:00
Kyle Havlovitz f50ce2084a
Only count healthy voters for FailureTolerance 2017-03-16 12:19:16 -07:00
Kyle Havlovitz 9c7bba7903
Tweak last_contact health logic for leader 2017-03-15 19:57:54 -07:00
Kyle Havlovitz bc0494e396
Reorganized cluster health check loop and logic 2017-03-15 18:27:17 -07:00
Kyle Havlovitz bb98e39dd4
Add tests for servers changing address/ID 2017-03-15 16:50:42 -07:00
Kyle Havlovitz c40279e012
Fix an issue with changing server IDs and add a few UX enhancements around autopilot features 2017-03-15 16:09:55 -07:00
Kyle Havlovitz 3c6bece859
Add autopilot guide to the docs 2017-03-10 14:55:18 -08:00
Kyle Havlovitz 4807215fa1 Merge pull request #2788 from hashicorp/f-autopilot-2
Autopilot server health monitoring
2017-03-10 12:29:45 -08:00
Kyle Havlovitz b15d67bfac
Use defers for WaitGroup and Ticker stop 2017-03-10 12:29:03 -08:00
Kyle Havlovitz 8130f9b1c1
Cleaned up and reorganized some autopilot-related code 2017-03-09 18:21:40 -08:00
James Phillips 1e313e339c
Adds token to deregister request when reconciling.
Fixes #2792.
2017-03-09 09:25:42 -08:00
Kyle Havlovitz a5cbee0e99
Add AutopilotPolicy interface and BasicAutopilot 2017-03-08 12:26:58 -08:00
Kyle Havlovitz a7de1e2a3b
Move RaftStats to Status endpoint 2017-03-07 13:58:06 -08:00
Kyle Havlovitz 8bcab6c6d7
Add autopilot server health tracking
This adds two goroutines to perform autopilot tasks on the leader - one
to monitor the health of servers and another to periodically clean up
dead servers with a limit on removal count. Also adds a new http endpoint,
`/v1/operator/autopilot/health`, for querying this information through an
operator RPC endpoint.
2017-03-06 16:00:10 -08:00
Kyle Havlovitz 23c492a74e
Rename DeadServerCleanup and make wording adjustments 2017-02-28 14:45:21 -08:00
Kyle Havlovitz f7b6d776f4
Add cli docs and minor test/comment tweaks 2017-02-24 16:55:44 -08:00
Kyle Havlovitz 459e72b011
Merge branch 'master' into f-autopilot 2017-02-24 15:55:18 -08:00
Kyle Havlovitz c9ddee1a79
Add CAS capability to autopilot config endpoint 2017-02-24 13:08:49 -08:00
James Phillips 3887c52cb2 Reserves an RPC selector byte for Consul Enterprise. 2017-02-24 09:54:33 -08:00
Kyle Havlovitz 56e22a719f
Add state store table and endpoints for autopilot 2017-02-23 20:32:13 -08:00
Kyle Havlovitz ae9fce0ae0
Move raft_protocol out of autopilot config 2017-02-23 13:08:40 -08:00
Kyle Havlovitz f9588b8d7f
Add raft version 2/3 compatibility 2017-02-22 12:53:32 -08:00
Kyle Havlovitz 2c9001a389
Add configurable cleanup of dead servers when a new server joins 2017-02-17 10:49:16 -08:00
Sean Chittenden cea8a2f5d5
Round the node lookup prefix down to the nearest modulo two size before
performing the lookup.

Hat tip: @dadgar
2017-02-02 12:13:58 -08:00
Sean Chittenden 06db5bc353
Reduce the size of the UUID Lookup Length restriction from `8` to `2`.
I'm torn on this.  It's useful from a UX perspective for an operator to
be able to type in something that's short.  At the same time, by
enforcing an `8` character length, we reduced the probability of a user
depending on the behavior and having it suddenly stop working in the
future when a duplicate prefix is injected into the environment.
2017-02-02 12:12:18 -08:00
Kyle Havlovitz fbcd43e95c Merge pull request #2704 from hashicorp/f-relay-query-responses
Add relay-factor arg to keyring operations
2017-02-02 12:15:19 -05:00
Kyle Havlovitz 4fc3bd3abf
Added -relay-factor param to keyring operations 2017-02-01 21:53:29 -05:00
James Phillips 40454c999a
Adds a test for node UUID or name lookups. 2017-02-01 16:41:44 -08:00
Sean Chittenden 1c5d6eff76 Merge pull request #2702 from hashicorp/f-dns-nodeid
DNS lookup by Consul node ID
2017-02-01 16:23:18 -08:00
Sean Chittenden f8b64ec5f8
Treat a uuid prefix lookup error as a soft error, as if a node name
lookup returned nil.

Add a TODO to note where a future point of logging should occur once a
logger is present and a few additional comments to explain the program
flow.
2017-02-01 16:09:25 -08:00
Sean Chittenden 6844ebb43b
Treat a uuid prefix lookup error as a soft error, as if a node name lookup returned nil.
Add a TODO to note where a future point of logging should occur once a
logger is present.
2017-02-01 15:51:25 -08:00
Sean Chittenden 1d9c5a3efb
Run a test of `NodeServices()` with a NodeID as an argument. 2017-02-01 15:41:10 -08:00
Sean Chittenden b241cfc7fd
Whoops. Return an empty set in the event that there are multiple matches. 2017-02-01 15:18:00 -08:00
Sean Chittenden 324215c842
Rename `nodeName` to `nodeNameOrID`. 2017-02-01 14:59:24 -08:00
Sean Chittenden 19c2cd106a
Toggle `AllowMissing` to false to accommodate old clients without Node IDs. 2017-02-01 14:58:34 -08:00
Sean Chittenden c9eea45b1c
Enable looking up consul nodes by their node ID.
Assuming the following output from a consul agent:

```
==> Consul agent running!
           Version: 'v0.7.3-43-gc5e140c-dev (c5e140c+CHANGES)'
           Node ID: '40e4a748-2192-161a-0510-9bf59fe950b5'
         Node name: 'myhost'
```

it is now possible to lookup nodes by their Node Name or Node ID, or a
prefix match of the Node ID, with the following caveats re: the prefix
match:

1) first eight digits of the Node ID are a required minimum (eight was
   chosen as an arbitrary number)
2) the length of the Node ID must be an even number or no result will be
   returned.

```
% dig @127.0.0.1 -p 8600 myhost.node.dc1.consul.
myhost.node.dc1.consul.	0	IN	A	127.0.0.1
% dig @127.0.0.1 -p 8600 40e4a748-2192-161a-0510-9bf59fe950b5.node.dc1.consul.
40e4a748-2192-161a-0510-9bf59fe950b5.node.dc1.consul. 0	IN A 127.0.0.1
% dig @127.0.0.1 -p 8600 40e4a748.node.dc1.consul.
40e4a748.node.dc1.consul. 0	IN	A	127.0.0.1
% dig @127.0.0.1 -p 8600 40e4a74821.node.dc1.consul.
40e4a74821.node.dc1.consul. 0	IN	A	127.0.0.1
% dig @127.0.0.1 -p 8600 40e4a748-21.node.dc1.consul.
40e4a748-21.node.dc1.consul. 0	IN	A	127.0.0.1
```
2017-02-01 14:46:25 -08:00
Kyle Havlovitz 086975ac0a
Add TLSMinVersion to config options 2017-02-01 16:20:33 -05:00
Sean Chittenden e39dd09bfa
Small premature optimization in `isUUID()`.
If the length isn't `36`, return `false` immediately before firing up
the regexp engine.
2017-02-01 11:00:06 -08:00
James Phillips 84a487526b
Tweaks leader test now that we have new wait timing. 2017-01-25 22:12:22 -08:00
James Phillips d780c49bac
Keeps the old state store state if a restore fails. 2017-01-25 19:42:34 -08:00
James Phillips 418b627f4e
Bails out of blocking queries when a state restore occurs. 2017-01-25 19:00:32 -08:00
James Phillips f286716899
Tweaks a few comments. 2017-01-25 09:58:23 -08:00
James Phillips 8fcf695fa1
Pass state store pointer into the blocking query work function.
Previously the blocking functions all closed over the state store from
their first query, with would not have worked properly when a restore
occurred. This makes sure they get a frest state store pointer each time,
and that pointer is synchronized with the abandon watch.
2017-01-25 09:58:23 -08:00
James Phillips 20ae4b6139
Guts all the old blocking query code. 2017-01-25 09:58:23 -08:00
James Phillips 943ca1b2d9
Cuts KVS endpoints over to new fine-grained watch plumbing. 2017-01-25 09:58:22 -08:00
James Phillips c3a1014fbf
Adds a facility to notify when restores occur. 2017-01-25 09:58:22 -08:00
James Phillips e59f398d80
Adds fine-grained watches to session endpoints. 2017-01-25 09:58:22 -08:00
James Phillips 997934c94f
Adds fine-grained watches to prepared query endpoints. 2017-01-25 09:58:22 -08:00
James Phillips 557df50be6
Adds fine-grained watches to internal endpoints. 2017-01-25 09:58:22 -08:00
James Phillips e1dd427cf4
Adds fine-grained watches to coordinate endpoints. 2017-01-25 09:58:22 -08:00
James Phillips 2cbf45301e
Adds fine-grained watch support to ACL endpoints. 2017-01-25 09:58:22 -08:00
James Phillips 635afd1924
Adds fine-grained watches to health endpoints. 2017-01-25 09:58:22 -08:00
James Phillips a604c438a2
Fixes a race condition when updating the state store during a snapshot restore. 2017-01-25 09:58:22 -08:00
James Phillips 0891b6c74d
Adds fine-grained watches to catalog endpoints. 2017-01-25 09:58:22 -08:00
James Phillips 5afa233d28
Adds diff check for node and service parts of register requests.
We always did an update before which caused excessive watch churn, even
with our new fine-grained queries. This does a diff any only updates the
node and service records if something actually changed.
2017-01-25 09:58:22 -08:00
James Phillips 40ef50c738
Don't do any watch tracking for non-blocking queries. 2017-01-25 09:58:22 -08:00