Commit Graph

943 Commits

Author SHA1 Message Date
James Phillips 052140f8a7 Merge pull request #1703 from alistanis/fix-issue-#1661
fixes issue #1661 and adds supporting test
2016-02-16 20:13:36 -08:00
James Phillips e79dd7c8de Fixes redirect from / to /ui when internal UI is enabled. 2016-02-12 16:11:32 -08:00
Chris Cooper 2c6f873ecd add missing test 2016-02-09 10:49:41 -05:00
Chris Cooper fe0e3aaaa0 fixes issue #1661 and adds supporting test 2016-02-09 10:35:39 -05:00
James Phillips 56cbabff63 Adds a sanity check to the local node info compare. 2016-02-07 15:07:23 -08:00
James Phillips d2cc2801fa Merge pull request #1698 from hashicorp/pr-1547-slackpad
Implements WAN address translation.
2016-02-07 14:26:04 -08:00
James Phillips 607728ddca Adds a test to make sure we get the local address within the DC. 2016-02-07 14:16:15 -08:00
James Phillips 524aaae9b7 Increases wait to account for random stagger. 2016-02-07 13:56:45 -08:00
James Phillips 6790930c4e Factors address translation into a single function. 2016-02-07 13:39:37 -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 b59599742d Adds a test to make sure the local sync doesn't clobber tagged addresses. 2016-02-07 11:26:19 -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 2f26771bb1 Add tests for consul WAN translation 2016-02-06 23:01:45 -08:00
Evan Gilman 146f719a66 Explicitly set advertise address in agent tests
Otherwise, the tests will fail when run on a machine with multiple
private addresses
2016-02-06 23:01:45 -08:00
Evan Gilman a3240d28ba Consider WAN addresses during Node and SRV record lookup 2016-02-06 23:01:45 -08:00
Evan Gilman 496cf5ae73 Implement `translate_wan_addrs` config option
This knob tells consul whether it should prefer the WAN address (if set)
when making service lookups in remote datacenters. This enables
reachability for remote services which are behind a NAT.
2016-02-06 23:01:45 -08:00
Evan Gilman 8fa2a60208 Rectify value of `AdvertiseAddrWan` when set elsewhere
`AdvertiseAddrs` has been introduced as a configuration option, which
duplicates a few other options, namely `AdvertiseAddrWan`. We need to
use this value elsewhere, so rather than doing a precedence check every
time we need to access it, rectify the value of `AdvertiseAddrWan` to
match
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
James Phillips 507c83bdbd Merge pull request #1690 from alistanis/use-http-package-statuses
refactors http server error codes
2016-02-06 22:38:48 -08:00
James Phillips d60be51f01 Merge pull request #1284 from nbrownus/telemetry
Option to disable hostnames from telemetry
2016-02-06 22:00:14 -08:00
James Phillips 7bc2ba4c18 Merge pull request #1654 from ryanslade/invalid-check-message
Updated invalid check error message.
2016-02-05 17:21:29 -08:00
Chris Cooper 5a07e89bb9 Merge branch 'master' of https://github.com/alistanis/consul into use-http-package-statuses 2016-02-05 17:30:43 -05:00
Chris Cooper e2065e10c0 add comment codes 2016-02-05 17:06:42 -05:00
Chris Cooper 00dd9d6b78 refactors http server error codes to use the http statuses defined in the http package instead of literals 2016-02-05 16:51:31 -05:00
Sean Chittenden 8deec17f73 Use panic instead of returning a sentinel UUID values in unit tests 2016-02-01 16:42:04 -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
Nate Brown 43a4f3fe02 Option to disable hostnames from telemetry 2016-01-29 13:44:48 -08:00
Ryan Slade dd98602bd7 Updated invalid check error message.
Added some of the newer reasons this error could have occured.
2016-01-28 11:02:00 +02:00
James Phillips f24a044755 Fixes the static asset generator for new pkg path, updates assets. 2016-01-15 10:21:42 -08:00
Seth Vargo cae0ff354a Use HTTPS + www. where appropriate 2016-01-13 17:44:01 -05:00
James Phillips 71e3901a65 Merge pull request #1592 from hashicorp/b-reap
Adds support for the reap lock.
2016-01-13 09:37:54 -08:00
James Phillips 343838f12b Adds support for the reap lock. 2016-01-12 21:10:25 -08:00
Matt McCoy 9cbed7f89e Add consul agent help for advertise-wan 2016-01-11 14:27:54 -05:00
James Phillips c1fe9092ed Merge pull request #1550 from hashicorp/f-devmode
Add a `-dev` mode for easy prototyping
2016-01-05 10:01:41 -08:00
Philippe M. Chiasson a2eddcab38 remove address splitting 2016-01-05 11:49:40 -05:00
Philippe M. Chiasson 21345a8a7f Move logged client IP to the end of the log message 2015-12-30 15:39:34 -05:00
Philippe M. Chiasson 34c36d9205 Merge branch 'master' of http://github.com/hashicorp/consul into issue/1447/http-access-logs 2015-12-30 15:38:30 -05:00
Ryan Uber 9002bfa37d agent: enable ui for dev mode 2015-12-26 20:39:42 -05:00
Ryan Uber afafae53fd consul: dev mode works 2015-12-26 20:19:36 -05:00
Ryan Uber 87c1283b73 agent: update assetfs output 2015-12-24 22:21:34 -05:00
Ryan Uber 3cf6a173a5 agent: static UI is configurable 2015-12-24 22:21:34 -05:00
Ryan Uber 2d7ced22b3 agent: initial web assets 2015-12-24 22:21:34 -05:00
Ryan Uber c3e7c98da2 agent: compile web assets into consul binary 2015-12-24 22:21:34 -05:00
Philippe M. Chiasson 9553ac0ca8 Merge branch 'master' of http://github.com/hashicorp/consul into issue/1447/http-access-logs 2015-12-22 14:55:18 -05:00
James Phillips d61661a98f Adds a Bool helper function. 2015-12-22 10:43:32 -08:00
James Phillips e80d1a58fb Moves logger down where it's used for reaping. 2015-12-22 10:29:55 -08:00
James Phillips 0b1c346990 Changes sense of option to "reap" and uses nil for "not set". 2015-12-22 10:28:10 -08:00
James Phillips 2b257c922e Adds child process reaping when Consul is running as PID 1. 2015-12-21 21:47:35 -08:00
James Phillips 651f255b9b Converts the DNS metric to a gauge which gives us a count and a time. 2015-12-21 18:25:09 -08:00
James Phillips a4dc11167f Adds telemetry on number of DNS queries served, per-agent. 2015-12-21 17:01:28 -08:00
WangFenjin 29c0516d58 Fix typo 2015-12-08 17:45:01 +08:00
James Phillips a61d89d0e6 Removes the GOMAXPROCS warnings which are obsolete for Go 1.5+. 2015-11-25 17:59:16 -08:00
Philippe M. Chiasson 65512cae73 Add client ip to http access logs
Fixes #1447
2015-11-24 15:06:33 -05:00
James Phillips 95c708f65e Adds Docker checks support to client API.
Also changed `DockerContainerId` to `DockerContainerID`, and updated the agent
API docs to reflect their support for Docker checks.
2015-11-18 07:40:02 -08:00
James Phillips 049da2cef2 Breaks up huge HTTP endpoint functions. 2015-11-17 09:16:04 -08:00
James Phillips cd6be4a88d Avoids taking the length again when parsing DNS queries. 2015-11-17 08:40:47 -08:00
James Phillips e1ce1a34b0 Moves conversion of nil slices up to HTTP layer for prepared queries. 2015-11-15 17:06:00 -08:00
James Phillips 4715c04c98 Adds a test to make sure a stale retry terminates. 2015-11-15 17:06:00 -08:00
James Phillips 67fd4fa78d Returns a 404 from a get or execute of a nonexistent query. 2015-11-15 17:06:00 -08:00
James Phillips e9480ecb02 Plumbs the service name back and uses agent-specific TTL settings as a fallback. 2015-11-15 17:06:00 -08:00
James Phillips 81b43135f9 Adds unit tests for prepared queries and DNS, using existing tests for equivalence. 2015-11-15 17:06:00 -08:00
James Phillips 4a0a60af55 Adds DNS support for prepared queries (needs tests). 2015-11-15 17:06:00 -08:00
James Phillips 5e7523ea4b Adds a slightly more flexible mock system so we can test DNS. 2015-11-15 17:06:00 -08:00
James Phillips da20e6668b Adds a note about obfuscating query name/ID from the logs. 2015-11-15 17:06:00 -08:00
James Phillips 57be55103c Adds an HTTP endpoint for prepared queries. 2015-11-15 17:06:00 -08:00
James Phillips 989619cb6b Moves DNS over to new shuffle and filter functions. 2015-11-15 17:06:00 -08:00
James Phillips c248b0017a Fixes nil slices from HTTP endpoints.
These would manifest in the HTTP output as Javascript nulls instead of
empty lists, so we had unintentionally changed the interface while
porting to the new state store. We added code to each HTTP endpoint to
convert nil slices to empty ones so they JSON-ify properly, and we added
tests to catch this in the future.
2015-11-14 21:05:37 -08:00
James Phillips 8defe75387 Merge pull request #1293 from talwai/master
Add options to send telemetry to DogStatsD
2015-11-13 09:51:50 -08:00
talwai f6f2e19c6c Kill unused import in command.go 2015-11-13 11:14:15 -05:00
James Phillips 98731f7272 Fixes unit test fail due to expected truncated message. 2015-11-12 18:16:44 -08:00
talwai bc12c5e711 Add DogStatsd configuration 2015-11-11 14:30:36 -05:00
James Phillips 3d1702969f Fixes a go vet finding. 2015-10-29 12:47:20 -07:00
James Phillips d06fc28a0a Prevents agents from considering Raft information when doing sync checks. 2015-10-28 14:32:00 -07:00
James Phillips c0bd639662 Makes the version upshift code look at the correct version field. 2015-10-27 14:44:34 -07:00
Diptanu Choudhury ab7ab8e58e Merge pull request #1343 from hashicorp/f-docker-check
Docker Support for Consul Health Checks
2015-10-26 21:00:48 -07:00
Diptanu Choudhury 3d68d06ac7 Forcing the Env variable to empty while testing the default shell logic 2015-10-26 20:35:13 -07:00
Diptanu Choudhury 2fdcf1ae28 Added a test for selecting shell from env 2015-10-26 20:21:50 -07:00
Diptanu Choudhury 471442e9a4 Making an explicit check to test whether a check is of type Monitor 2015-10-26 19:52:32 -07:00
Diptanu Choudhury 1e240b5c59 Fixed the tests 2015-10-26 18:20:02 -07:00
Diptanu Choudhury f0c783d1a8 Added a test to check if we are properly truncating docker exec outputs 2015-10-26 18:06:55 -07:00
Diptanu Choudhury 582786523a Added a test for exit code 1 with docker exec 2015-10-26 16:58:09 -07:00
Diptanu Choudhury 9efbd1affa Fixed the Fake Docker client to simulate Exec start failures 2015-10-26 16:54:51 -07:00
Diptanu Choudhury 423f7fbcac Not adding the docker check if we couldn't create the client 2015-10-26 16:45:12 -07:00
Diptanu Choudhury f5f5ed0c79 Making sure the script is not empty if it's a docker check 2015-10-26 16:27:48 -07:00
Diptanu Choudhury b4af7f44af Updated the comment for CheckType 2015-10-26 15:28:13 -07:00
Diptanu Choudhury 4c1818eb61 Collect and truncate the output from docker exec 2015-10-26 15:19:35 -07:00
Diptanu Choudhury 5f8f531d2a Defaulting to Monitor check 2015-10-26 15:02:23 -07:00
Diptanu Choudhury 809e9f5284 Extracted the logic of figuring out the shell and fixing the logic to find out if the check is a Docker check 2015-10-26 15:00:34 -07:00
Diptanu Choudhury 31cdf4fe64 Added some tests for docker check 2015-10-26 12:59:40 -07:00
James Phillips f6b589d768 Merge pull request #1296 from hashicorp/f-fast-sync
agent: remove an N^2 check. See #1265
2015-10-26 11:37:52 -07:00
Diptanu Choudhury 40f72a8323 Marking the state of a service as critical if the Docker Daemon doesn't respond while running checks 2015-10-26 11:16:11 -07:00
Diptanu Choudhury d695012e40 Adding a debug log to indicate the exit code of failed check 2015-10-26 10:35:51 -07:00
Diptanu Choudhury 83db728133 Registering the Exec with Docker Daemon everytime the check is invoked 2015-10-26 10:23:57 -07:00
Diptanu Choudhury 71ede8addb Implemented Docker health checks 2015-10-26 10:23:57 -07:00
James Phillips 088603949c Runs go fmt (sorts new go-cleanhttp imports). 2015-10-23 17:14:35 -07:00
James Phillips ecd3a1d1d2 Completes rebase of network coordinates to new memdb. 2015-10-23 15:23:01 -07:00
James Phillips 660da92152 Makes the default protocol 2 and lets 3 interoperate with 2. 2015-10-23 15:23:01 -07:00
James Phillips e21b450f69 Runs go fmt after latest rebase. 2015-10-23 15:23:01 -07:00
James Phillips e8322ffe00 Adds a test for the `DisableCoordinate` config. 2015-10-23 15:23:01 -07:00
James Phillips f9da231a1c Adds coordinate of agent to self endpoint. 2015-10-23 15:23:01 -07:00
James Phillips 6289764ea2 Moves sorting up into coordinate endpoint HTTP handlers. 2015-10-23 15:23:01 -07:00
James Phillips d45fc23abf Installs a friendly handler for coordinate endpoints when coordinates are disabled. 2015-10-23 15:23:01 -07:00
James Phillips ce0e9759f8 Fixes config merge fn for disabling coordinates and adds it to JSON. 2015-10-23 15:23:01 -07:00
James Phillips 33e3505aea Adds endpoints for raw network coordinates. 2015-10-23 15:23:01 -07:00
James Phillips 9c9195746f Changes ?near=self to a safer ?near=_agent, which is also clearer about what it does. 2015-10-23 15:23:01 -07:00
James Phillips 9caa5b3653 Adds distance sorting to health endpoint. Cleans up unit tests. 2015-10-23 15:23:01 -07:00
James Phillips e47eea3f3a Adds a magic "self" node name to distance queries. 2015-10-23 15:23:01 -07:00
James Phillips 54ef97b268 Adds tests for HTTP interface. Removes a stray mark. 2015-10-23 15:23:01 -07:00
James Phillips 89c7203f31 Adds coordinate sorting support to catalog queries for nodes and service nodes. 2015-10-23 15:23:01 -07:00
James Phillips d734697820 Turns down the coordinate sync rate a bit more. 2015-10-23 15:23:01 -07:00
James Phillips ad65d953f6 Scales coordinate sends to hit a fixed aggregate rate across the cluster. 2015-10-23 15:23:01 -07:00
James Phillips 66a3d29743 Simplifies the batching function and adds some comments. 2015-10-23 15:23:01 -07:00
James Phillips 5f754c4a87 Does some small cleanups based on PR feedback.
* Holds coordinate updates in map and gets rid of the update channel.
* Cleans up config variables a bit.
2015-10-23 15:23:01 -07:00
James Phillips 7e6d52109b Hardens Consul from bad coordinates from other nodes. 2015-10-23 15:23:01 -07:00
James Phillips d12aa2ffab Moves batching down into the state store and changes it to fail-fast.
* A batch of updates is done all in a single transaction.
* We no longer need to get an update to kick things, there's a periodic flush.
* If incoming updates overwhelm the configured flush rate they will be dumped with an error.
2015-10-23 15:23:01 -07:00
James Phillips b9d5fb0f90 Flips the sense of the coordinate enable option. 2015-10-23 15:23:01 -07:00
James Phillips 92567841d6 Removes one more WAN leftover. 2015-10-23 15:23:01 -07:00
James Phillips 86b112fe31 Does a clean up pass on the Consul side. 2015-10-23 15:23:01 -07:00
James Phillips 01d2452ea3 Merges config changes after rebase. 2015-10-23 15:23:01 -07:00
Derek Chiang f144d17b1c Address comments 2015-10-23 15:23:01 -07:00
Derek Chiang ab9262c656 Add a test case 2015-10-23 15:23:01 -07:00
Derek Chiang bf5cb7522f Use IndexedCoordinate instead 2015-10-23 15:23:01 -07:00
Derek Chiang a1854a7614 Some fixes 2015-10-23 15:23:01 -07:00
Derek Chiang a338e5efe8 Fix a comment 2015-10-23 15:23:01 -07:00
Derek Chiang 98d87b5dd5 Complete logic for sending coordinates 2015-10-23 15:23:01 -07:00
Derek Chiang 9113b26286 Some fixes 2015-10-23 15:23:01 -07:00
Derek Chiang a9ea503c69 Adding tests and stuff 2015-10-23 15:23:01 -07:00
Armon Dadgar 6a350d5d19 Merge pull request #1318 from daveadams/f-http-header-token
Allow specifying Consul token in an HTTP request header
2015-10-22 13:33:47 -07:00
Jeff Mitchell 1e3840b044 Update cleanhttp repo location 2015-10-22 14:14:22 -04:00
Jeff Mitchell 9a5fd5424a Use cleanhttp to get rid of DefaultTransport 2015-10-22 10:47:50 -04:00
David Adams b7bcb2a414 Add HTTP request header X-Consul-Token
Add support for an X-Consul-Token HTTP request header to specify the
token with which this request should be fulfilled. The header would have
precedence over the responding Agent's default token, but would have
lower precedence than a token specified in the query string.
2015-10-19 11:26:01 -05:00
James Phillips 4ee43e90b7 Deletes the old state store and all its accoutrements. 2015-10-15 14:59:09 -07:00
James Phillips 0c90bdc61a Knocks out the Raft indexes before doing compare. 2015-10-15 14:59:09 -07:00
James Phillips d57431e300 Gets new structs changes to compile, adds some corner case handling and extra unit tests. 2015-10-15 14:59:09 -07:00
Ryan Uber d6af59cded Merge pull request #1309 from hashicorp/f-remove-migrate
Removes consul-migrate for 0.6
2015-10-15 14:50:19 -07:00
Jeff Mitchell f49fc095ef Don't use http.DefaultClient
Two of the changes are in tests; the one of consequence is in the API.
As explained in #1308 this can cause conflicts with downstream programs.

Fixes #1308.
2015-10-15 17:49:35 -04:00
Ryan Uber de287e3efb agent: consolidates data dir checker 2015-10-15 14:21:35 -07:00
Ryan Uber 10b971df21 agent: test mdb dir protection 2015-10-15 14:15:41 -07:00
Ryan Uber d901fa6389 agent: remove migrator, refuse to start if mdb dir found 2015-10-15 14:15:08 -07:00
Armon Dadgar d137a5fa82 agent: remove an N^2 check. See #1265 2015-10-12 20:30:11 -07:00
Michael Puncel a98d25b541 Add http method to log output 2015-10-02 18:33:06 -07:00
James Phillips 0b05dbeb21 Merge pull request #1235 from wuub/master
fix conflict between handleReload and antiEntropy critical sections
2015-09-17 07:28:39 -07:00
Wojciech Bederski c4537ed26f panic when unbalanced localState.Resume() is detected 2015-09-17 11:32:08 +02:00
Dale Wijnand 5a28ebcaa3 Fix a bunch of typos. 2015-09-15 13:22:08 +01:00
James Phillips 2f9ebdb135 Merge pull request #1187 from sfncook/enable_tag_drift_03
Enable tag drift 03
2015-09-11 15:35:32 -07:00
Anthony Scalisi 10e028d599 remove various typos 2015-09-11 12:29:54 -07:00
Wojciech Bederski b014c0f91b make Pause()/Resume()/isPaused() behave more like a semaphore
see: https://github.com/hashicorp/consul/issues/1173 #1173

Reasoning: somewhere during consul development Pause()/Resume() and
PauseSync()/ResumeSync() were added to protect larger changes to
agent's localState.  A few of the places that it tries to protect are:

- (a *Agent) AddService(...)      # part of the method
- (c *Command) handleReload(...)  # almost the whole method
- (l *localState) antiEntropy(...)# isPaused() prevents syncChanges()

The main problem is, that in the middle of handleReload(...)'s
critical section it indirectly (loadServices()) calls  AddService(...).
AddService() in turn calls Pause() to protect itself against
syncChanges(). At the end of AddService() a defered call to Resume() is
made.

With the current implementation, this releases
isPaused() "lock" in the middle of handleReload() allowing antiEntropy
to kick in while configuration reload is still in progress.
Specifically almost all services and probably all check are unloaded
when syncChanges() is allowed to run.

This in turn can causes massive service/check de-/re-registration,
and since checks are by default registered in the critical state,
a majority of services on a node can be marked as failing.
It's made worse with automation, often calling `consul reload` in close
proximity on many nodes in the cluster.

This change basically turns Pause()/Resume() into P()/V() of
a garden-variety semaphore. Allowing Pause() to be called multiple times,
and releasing isPaused() only after all matching/defered Resumes() are
called as well.

TODO/NOTE: as with many semaphore implementations, it might be reasonable
to panic() if l.paused ever becomes negative.
2015-09-11 18:28:06 +02:00
Wojciech Bederski 24bc17eaa1 failing test showing that nested Pause()/Resume() release too early
see: #1173 / https://github.com/hashicorp/consul/issues/1173
2015-09-11 17:52:57 +02:00
Shawn Cook 66fd8fb2a0 Rename EnableTagOverride and update formatting 2015-09-11 08:35:29 -07:00