Commit Graph

7033 Commits

Author SHA1 Message Date
Frank Schroeder ccbae7da5b local state: replace multi-map state with structs
The state of the service and health check records was spread out over
multiple maps guarded by a single lock. Access to the maps has to happen
in a coordinated effort and the tests often violated this which made
them brittle and racy.

This patch replaces the multiple maps with a single one for both checks
and services to make the code less fragile.

This is also necessary since moving the local state into its own package
creates circular dependencies for the tests. To avoid this the tests can
no longer access internal data structures which they should not be doing
in the first place.

The tests still don't compile but this is a ncessary step in that
direction.
2017-10-23 08:03:18 +02:00
Frank Schroeder d447e823c6 local state: move to separate package
This patch moves the local state to a separate package to further
decouple it from the agent code.

The code compiles but the tests do not yet.
2017-10-23 08:03:18 +02:00
Frank Schroeder b5dbad910c agent: simplify some loops 2017-10-23 08:03:18 +02:00
Frank Schroeder 7a2af206ea agent: refactor sync loop to linear flow of control 2017-10-23 08:03:18 +02:00
Frank Schroeder b7136e100b agent: cleanup StateSyncer
This patch cleans up the state syncer code by renaming fields, adding
helpers and documentation.
2017-10-23 08:03:18 +02:00
Frank Schroeder a842dc9c2b agent: decouple anti-entropy from local state
The anti-entropy code manages background synchronizations of the local
state on a regular basis or on demand when either the state has changed
or a new consul server has been added.

This patch moves the anti-entropy code into its own package and
decouples it from the local state code since they are performing
two different functions.

To simplify code-review this revision does not make any optimizations,
renames or refactorings. This will happen in subsequent commits.
2017-10-23 08:03:18 +02:00
James Phillips dca5dcb68c Changes "ip" to "IP". 2017-10-23 08:01:25 +02:00
Frank Schroeder 6ba9690e81 doc: address review comment 2017-10-23 08:01:25 +02:00
Frank Schroeder 1db8d3cb00 config: do not allow an ANY address as DNS recursor 2017-10-23 08:01:25 +02:00
Frank Schroeder 6d4a57aedc doc: update docs for dns recursor go-sockaddr templates 2017-10-23 08:01:25 +02:00
Frank Schroeder 72bee6284d config: add support for go-sockaddr templates for DNS recursors
DNS recursors can be added through go-sockaddr templates. Entries
are deduplicated while the order is maintained.

Originally proposed by @taylorchu

See #2932
2017-10-23 08:01:25 +02:00
James Phillips 3ab8b50133
Tweaks watch docs. 2017-10-21 20:09:37 -07:00
James Phillips 23d4b24792
Cleans up import sorting. 2017-10-21 20:08:11 -07:00
James Phillips fb465707df Update CHANGELOG.md 2017-10-21 20:03:58 -07:00
preetapan 6d34bc3e7d Update CHANGELOG.md 2017-10-21 21:30:04 -05:00
preetapan f1ec6191ae Update CHANGELOG.md 2017-10-21 21:28:58 -05:00
Preetha Appan 1af51560d0 Update serf library to pick up coordinate persistence fix 2017-10-21 21:19:43 -05:00
preetapan 41343cddaf Update CHANGELOG.md 2017-10-21 21:08:34 -05:00
preetapan e03fce5bcd Update CHANGELOG.md 2017-10-21 21:07:30 -05:00
preetapan bed69cefb2 Update watches.html.md 2017-10-21 20:59:47 -05:00
Preetha Appan 28a3901f10 Small grammar correction 2017-10-21 20:55:15 -05:00
Preetha Appan cdb5f8c3c9 Improve HTTP handler documentation 2017-10-21 20:51:37 -05:00
Hadar Greinsmark 7e1a860978 Implement HTTP Watch handler (#3413)
Implement HTTP Watch handler
2017-10-21 20:39:09 -05:00
Frank Schroeder c94751ad43 test: replace porter tool with freeport lib
This patch removes the porter tool which hands out free ports from a
given range with a library which does the same thing. The challenge for
acquiring free ports in concurrent go test runs is that go packages are
tested concurrently and run in separate processes. There has to be some
inter-process synchronization in preventing processes allocating the
same ports.

freeport allocates blocks of ports from a range expected to be not in
heavy use and implements a system-wide mutex by binding to the first
port of that block for the lifetime of the application. Ports are then
provided sequentially from that block and are tested on localhost before
being returned as available.
2017-10-21 22:01:09 +02:00
James Phillips ad9425ca63
Adds a canary test to fail Consul's test w/o porter. 2017-10-20 17:05:25 -07:00
James Phillips e8e4e5f867
Updates the change log. 2017-10-20 16:51:43 -07:00
Frank Schröder 350932161d dns: return NXDOMAIN if datacenter is invalid (#3200) (#3596)
Queries to the DNS server can contain an optional datacenter
name in the query name. You can query for 'foo.service.consul'
or 'foo.service.dc.consul' to get a response for either the
default or a specific datacenter.

Datacenter names cannot have dots, therefore the datacenter
name can refer to only one element in the DNS query name.

The DNS server allowed extra labels between the optional
datacenter name and the domain and returned a valid response
instead of returning NXDOMAIN. For example, if the domain
is set to '.consul' then 'foo.service.dc1.extra.consul'
should return NXDOMAIN because of 'extra' being between
the datacenter name 'dc1' and the domain '.consul'.

Fixes #3200
2017-10-20 16:49:17 -07:00
Alex Dadgar c7a65b4587 Testutil falls back to random ports w/o porter (#3604)
* Testutil falls back to random ports w/o porter

This PR allows the testutil server to be used without porter.

* Adds sterner-sounding fallback comments.
2017-10-20 16:46:13 -07:00
Frank Schroeder 8ad8331f7d
doc: address review comment 2017-10-20 20:06:33 +02:00
Frank Schroeder 8a9c81ed85
config: do not allow an ANY address as DNS recursor 2017-10-20 20:00:45 +02:00
preetapan 211f886f11 Merge pull request #3601 from hashicorp/serf_update
Serf update
2017-10-20 11:17:34 -05:00
Preetha Appan f94ba25b9d REbase master serf 2017-10-20 10:33:59 -05:00
Preetha Appan c6c5cd5b48 Update CHANGELOG.md 2017-10-20 10:18:19 -05:00
Preetha Appan 9449a60fae Vendor update serf to pick up fix for out of range ping periods in coordinate subsystem 2017-10-20 10:14:15 -05:00
Frank Schroeder 2122f16a69
doc: update docs for dns recursor go-sockaddr templates 2017-10-20 15:51:49 +02:00
Frank Schroeder 0a0d6af04d
config: add support for go-sockaddr templates for DNS recursors
DNS recursors can be added through go-sockaddr templates. Entries
are deduplicated while the order is maintained.

Originally proposed by @taylorchu

See #2932
2017-10-20 15:51:49 +02:00
Johan Brandhorst 4ebdff30ef Fixed indentation in Script + Interval
Remove newlines which were causing the text to not be rendered under the intended bullet point.
2017-10-20 14:02:31 +02:00
James Phillips ecee15b466
Updates documentation for consul validate.
This makes it clear that you need to pass the full configuration,
and that the command won't work with config fragments.

Closes #3591
2017-10-19 18:59:05 -07:00
Preetha Appan 77cd2e7e6e Update CHANGELOG.md 2017-10-19 12:59:12 -05:00
preetapan 7750bb3cb3 Merge pull request #3595 from hashicorp/kms_doc_update
Documentation update for KMS support
2017-10-19 12:38:58 -05:00
Preetha Appan 18ccd3a80b Documentation update for KMS support 2017-10-19 11:39:14 -05:00
Preetha Appan 89b98d2fe2 Update autopilot documentation to mention correct Consul version that defaults raft protocol to 3. 2017-10-19 11:31:29 -05:00
Jay 4d95a56b43 s/acesss/access (#3593)
Spell "access" correctly
2017-10-18 17:24:56 -07:00
Ryan Slade dcb392df46 Simplify string(buf.Bytes()) to buf.String() (#3590) 2017-10-18 13:26:09 -07:00
James Phillips cafd20d3f0
Updates the change log. 2017-10-18 11:32:53 -07:00
James Phillips 53f67c3993 Fixes API client for ScriptArgs and updates documentation. (#3589)
* Updates the API client to support the current `ScriptArgs` parameter
for checks.

* Updates docs for checks to explain the `ScriptArgs` parameter issue.

* Adds mappings for "args" and "script-args" to give th API parity
with config.

* Adds checks on return codes.

* Removes debug logging that shows empty when args are used.
2017-10-18 11:28:39 -07:00
Kuba Tyszko 516e2efae8 consul upgraded to 1.0.0 in terraform scripts (#3588) 2017-10-18 10:08:25 -07:00
Vladislav Mitov 3b280ead55 Update check.html.md 2017-10-18 13:43:32 +02:00
Frank Schroeder 86901b887d porter: add better warning if missing 2017-10-18 09:58:58 +02:00
Frank Schroeder 9dec64dd17
commands: add shorter helper vars to keep fmt sane 2017-10-18 02:39:10 +02:00