1193 Commits

Author SHA1 Message Date
Sergey Romanov
93c8b496e5 #735 add information about leader to consul members 2016-03-18 17:05:40 -07:00
Wim
b5d45322b4 Allow [::] as a bind address (binds to first public IPv6 address) 2016-03-18 23:59:44 +01:00
Calvin Leung Huang
4bd5523276 Obfuscate token for lookupACL error 2016-03-15 17:16:25 -04:00
James Phillips
cb9c908a99 Hardens the match interoplator against negative arguments. 2016-03-07 13:32:32 -08:00
James Phillips
1cad6b9e0f Adds a comment about the embedded struct. 2016-03-07 10:45:39 -08:00
James Phillips
eb7004f2b8 Renames "debug" endpoint and structures to "explain". 2016-03-07 10:45:39 -08:00
James Phillips
d7288e3a5e Adds a prepared query debug endpoint. 2016-03-07 10:45:39 -08:00
James Phillips
c7ee82c67f Applies prefix ACL to a catch-all template as a special case. 2016-03-07 10:45:39 -08:00
James Phillips
79eccf2c66 Adds a test for the custom prepared query template indexer. 2016-03-07 10:45:39 -08:00
James Phillips
897ab0d5c7 Adds core query template tests to the state store. 2016-03-07 10:45:39 -08:00
James Phillips
328d138466 Adds in basic query template lookups and vendors newly-updated memdb as well as improved iradix tree. 2016-03-07 10:45:39 -08:00
James Phillips
07514214e1 Adds tests for the low-level template functions. 2016-03-07 10:45:39 -08:00
James Phillips
e3827923b8 Adds tests for the string visitor. 2016-03-07 10:45:39 -08:00
James Phillips
799339acb5 Factors rendering down into the resolve function. 2016-03-07 10:45:39 -08:00
James Phillips
6ed64e7f05 Splits walk functions out from the rest of the template code. 2016-03-07 10:45:39 -08:00
James Phillips
998b691878 Integrates templates into state store and endpoint (sans tests). 2016-03-07 10:45:39 -08:00
James Phillips
c816f79bf8 Wraps the prepared query to also store the compiled template. 2016-03-07 10:45:39 -08:00
James Phillips
331f1f5b8b Adds basic query template compiler and renderer. 2016-03-07 10:45:39 -08:00
Mike Cowgill
5435055c5f one line schema change to not allow missing for sessions Table node index, Fixes #1774 2016-03-02 21:19:53 -08:00
James Phillips
90898dff98 Adds missing token redact in the GET path. 2016-02-26 15:59:00 -08:00
James Phillips
213026b033 Merge pull request #1757 from hashicorp/f-revert-1667
Reverts server connection rebalancing changes from #1667
2016-02-24 18:07:13 -08:00
James Phillips
7d392118d2 Adds a check for users re-submitting the redacted token. 2016-02-24 17:35:26 -08:00
James Phillips
483898abe5 Renames "prepared_query" ACL policy to "query". 2016-02-24 17:02:06 -08:00
James Phillips
87ceb2f3de Changes to more idiomatic "ok" pattern for prefix getter. 2016-02-24 16:26:43 -08:00
James Phillips
e283f9512e Renames a unit test. 2016-02-24 16:17:20 -08:00
James Phillips
ff25d033a6 Revert "Merge pull request #1667 from hashicorp/b-redistribute-clients"
This reverts commit 8f30dea4209491ebbe4ef9ab94dd8052d17bdbe9, reversing
changes made to eb27a02956e7e052c0bec6f96a0c0f7f6675f6a6.
2016-02-24 15:38:03 -08:00
James Phillips
899dcfe053 Completes switch of prepared_query ACLs to govern query names. 2016-02-24 01:26:16 -08:00
James Phillips
67de77482e Creates new "prepared-query" ACL type and new token capture behavior.
Prior to this change, prepared queries had the following behavior for
ACLs, which will need to change to support templates:

1. A management token, or a token with read access to the service being
   queried needed to be provided in order to create a prepared query.

2. The token used to create the prepared query was stored with the query
   in the state store and used to execute the query.

3. A management token, or the token used to create the query needed to be
   supplied to perform and CRUD operations on an existing prepared query.

This was pretty subtle and complicated behavior, and won't work for
templates since the service name is computed at execution time. To solve
this, we introduce a new "prepared-query" ACL type, where the prefix
applies to the query name for static prepared query types and to the
prefix for template prepared query types.

With this change, the new behavior is:

1. A management token, or a token with "prepared-query" write access to
   the query name or (soon) the given template prefix is required to do
   any CRUD operations on a prepared query, or to list prepared queries
   (the list is filtered by this ACL).

2. You will no longer need a management token to list prepared queries,
   but you will only be able to see prepared queries that you have access
   to (you get an empty list instead of permission denied).

3. When listing or getting a query, because it was easy to capture
   management tokens given the past behavior, this will always blank out
   the "Token" field (replacing the contents as <hidden>) for all tokens
   unless a management token is supplied. Going forward, we should
   discourage people from binding tokens for execution unless strictly
   necessary.

4. No token will be captured by default when a prepared query is created.
   If the user wishes to supply an execution token then can pass it in via
   the "Token" field in the prepared query definition. Otherwise, this
   field will default to empty.

5. At execution time, we will use the captured token if it exists with the
   prepared query definition, otherwise we will use the token that's passed
   in with the request, just like we do for other RPCs (or you can use the
   agent's configured token for DNS).

6. Prepared queries with no name (accessible only by ID) will not require
   ACLs to create or modify (execution time will depend on the service ACL
   configuration). Our argument here is that these are designed to be
   ephemeral and the IDs are as good as an ACL. Management tokens will be
   able to list all of these.

These changes enable templates, but also enable delegation of authority to
manage the prepared query namespace.
2016-02-23 17:12:43 -08:00
James Phillips
778a26efaf Adds a test for node registration and tagged addresses. 2016-02-07 13:15:22 -08:00
James Phillips
4be2ab1a75 Moves tagged wan address to be managed by anti-entropy, not serf. 2016-02-07 13:12:42 -08:00
James Phillips
33462ebea9 Adds an FSM persist and restore test for tagged addresses. 2016-02-07 11:36:39 -08:00
James Phillips
c60a526fde Sets up config for more address tags down the road, renames struct members. 2016-02-07 10:37:34 -08:00
Evan Gilman
de8fd561d0 Use a map for additional node addresses 2016-02-06 23:01:45 -08:00
Evan Gilman
069a28b3c0 Use idiomatic name for wan_addr serf tag 2016-02-06 23:01:45 -08:00
James Phillips
ed8a71efd7 Store WanAddress during Service/Check sync 2016-02-06 23:01:45 -08:00
Evan Gilman
9300a13643 Store WanAddress during node registration 2016-02-06 23:01:45 -08:00
Evan Gilman
90aafbbdb6 Store WanAddress on Node 2016-02-06 23:01:45 -08:00
Sean Chittenden
1f725e2d05 Use the server's address in debug logging, not the c.lastServer, which may be nil 2016-02-02 15:51:28 -08:00
Sean Chittenden
1c9d74a337 Remove unnecessary check, test was moved further up in scope 2016-02-02 11:13:58 -08:00
Sean Chittenden
1005b91c87 Use panic instead of returning a sentinel UUID values in unit tests 2016-02-01 23:15:19 -08:00
Sean Chittenden
c7e58734ed Continually rebalance client connections
Introduce a low-level background connection expiration mechanism wherein connections will be recycled periodically based on the size and health of the cluster.

For the vast majority of consul users, this will mean an average connection age of 150s.  For 10K node clusters it will take ~3min for clusters to rebalance their connections.  In the pathological case for a 100K cluster where 99K clients are in the minority talking to 1x server it will take ~26min to rebalance all connections.

It's possibe for clients recovering from a parititon to become fixated on a single server until the server or agent is restarted.  This is of particular interest to long-running environments with stable agents, where `allow_stale` is true, and partitions occur periodically.
2016-01-30 17:13:50 -08:00
Sean Chittenden
0c83b1b692 Use rand.Int31n() vs unconditionally using modulus 2016-01-30 15:47:58 -08:00
Sean Chittenden
7fb0045bbe Merge branch 'f-consul-lib' of ssh://github.com/hashicorp/consul into b-redistribute-clients 2016-01-30 15:40:54 -08:00
Sean Chittenden
c4f7b4a13e Rename clientRPCCache to clientRPCConnMaxIdle, change value
Increase the max idle time for agents talking to servers from 30s to 127s in order to allow for the reuse of connections that are being initiated by cron.

127s was chosen as the first prime above 120s (arbitrarily chose to use a prime) with the intent of reusing connections who are used by once-a-minute cron(8) jobs *and* who use a 60s jitter window (e.g. in vixie cron job execution can drift by up to 59s per job, or 119s for a once-a-minute cron job).
2016-01-30 15:27:46 -08:00
Sean Chittenden
b391b075bd Reuse the results from gettimeofday(2)...
Inside of a single RPC call, reuse time.Now().
2016-01-30 14:39:17 -08:00
Sean Chittenden
7af6a94edb Factor out duplicate functions into a lib package
Consolidate code duplication and tests into a single lib package.  Most of these functions were from various **/util.go functions that couldn't be imported due to cyclic imports.  The consul/lib package is intended to be a terminal node in an import DAG and a place to stash various consul-only helper functions.  Pulled in hashicorp/go-uuid instead of consolidating UUID access.
2016-01-29 16:57:45 -08:00
James Phillips
01da5a2248 Prevents watches from being orphaned when KVS blocking queries loop. 2016-01-20 07:18:47 -08:00
James Phillips
94d3f881fe Merge pull request #948 from hashicorp/iface-down-fix
Don't try to bind on address from inactive interface
2016-01-14 17:00:54 -08:00
Ryan Uber
2bcaa8ac38 consul: address comments 2016-01-05 09:45:36 -08:00
Ryan Uber
90566d4bde consul: disable serf snapshots in dev mode 2015-12-26 20:39:49 -05:00