Commit Graph

190 Commits

Author SHA1 Message Date
Frank Schröder 12216583a1 New config parser, HCL support, multiple bind addrs (#3480)
* new config parser for agent

This patch implements a new config parser for the consul agent which
makes the following changes to the previous implementation:

 * add HCL support
 * all configuration fragments in tests and for default config are
   expressed as HCL fragments
 * HCL fragments can be provided on the command line so that they
   can eventually replace the command line flags.
 * HCL/JSON fragments are parsed into a temporary Config structure
   which can be merged using reflection (all values are pointers).
   The existing merge logic of overwrite for values and append
   for slices has been preserved.
 * A single builder process generates a typed runtime configuration
   for the agent.

The new implementation is more strict and fails in the builder process
if no valid runtime configuration can be generated. Therefore,
additional validations in other parts of the code should be removed.

The builder also pre-computes all required network addresses so that no
address/port magic should be required where the configuration is used
and should therefore be removed.

* Upgrade github.com/hashicorp/hcl to support int64

* improve error messages

* fix directory permission test

* Fix rtt test

* Fix ForceLeave test

* Skip performance test for now until we know what to do

* Update github.com/hashicorp/memberlist to update log prefix

* Make memberlist use the default logger

* improve config error handling

* do not fail on non-existing data-dir

* experiment with non-uniform timeouts to get a handle on stalled leader elections

* Run tests for packages separately to eliminate the spurious port conflicts

* refactor private address detection and unify approach for ipv4 and ipv6.

Fixes #2825

* do not allow unix sockets for DNS

* improve bind and advertise addr error handling

* go through builder using test coverage

* minimal update to the docs

* more coverage tests fixed

* more tests

* fix makefile

* cleanup

* fix port conflicts with external port server 'porter'

* stop test server on error

* do not run api test that change global ENV concurrently with the other tests

* Run remaining api tests concurrently

* no need for retry with the port number service

* monkey patch race condition in go-sockaddr until we understand why that fails

* monkey patch hcl decoder race condidtion until we understand why that fails

* monkey patch spurious errors in strings.EqualFold from here

* add test for hcl decoder race condition. Run with go test -parallel 128

* Increase timeout again

* cleanup

* don't log port allocations by default

* use base command arg parsing to format help output properly

* handle -dc deprecation case in Build

* switch autopilot.max_trailing_logs to int

* remove duplicate test case

* remove unused methods

* remove comments about flag/config value inconsistencies

* switch got and want around since the error message was misleading.

* Removes a stray debug log.

* Removes a stray newline in imports.

* Fixes TestACL_Version8.

* Runs go fmt.

* Adds a default case for unknown address types.

* Reoders and reformats some imports.

* Adds some comments and fixes typos.

* Reorders imports.

* add unix socket support for dns later

* drop all deprecated flags and arguments

* fix wrong field name

* remove stray node-id file

* drop unnecessary patch section in test

* drop duplicate test

* add test for LeaveOnTerm and SkipLeaveOnInt in client mode

* drop "bla" and add clarifying comment for the test

* split up tests to support enterprise/non-enterprise tests

* drop raft multiplier and derive values during build phase

* sanitize runtime config reflectively and add test

* detect invalid config fields

* fix tests with invalid config fields

* use different values for wan sanitiziation test

* drop recursor in favor of recursors

* allow dns_config.udp_answer_limit to be zero

* make sure tests run on machines with multiple ips

* Fix failing tests in a few more places by providing a bind address in the test

* Gets rid of skipped TestAgent_CheckPerformanceSettings and adds case for builder.

* Add porter to server_test.go to make tests there less flaky

* go fmt
2017-09-25 11:40:42 -07:00
Frank Schroeder 9362cbcbc2
Add support to discover public v4 and v6 addresses on AWS (#3471)
Update github.com/hashicorp/go-discover/provider/aws to support the
'addr_type' option which allows detection of private_v4, public_v4 and
public_v6 addresses.

Fixes #3471
2017-09-25 03:16:27 +02:00
Preetha Appan 276f26ea70 Updating vendor directory for raft address provider interface changes 2017-08-30 09:57:48 -05:00
Preetha Appan 30fd0d25a5 Update raft library for windows snapshot fsync fixes. This fixes #3409 2017-08-24 16:44:05 -05:00
Frank Schroeder ad82659eed vendor: upgrade github.com/hashicorp/go-discover
Pull in improved debug logging for AWS
2017-08-23 21:23:34 +02:00
Preetha Appan c9d5e17410 Update serf to pick up fixes for fsyncing snapshots and panic when coordinates are disabled 2017-08-17 16:35:06 -05:00
Preetha Appan 0e73777ce2 Update memberlist for a deadlock fix 2017-08-15 18:07:28 -05:00
James Phillips 1eea530ce6
Propagates a better error message from memberlist.
Fixes #3312.
2017-08-07 16:35:57 -07:00
Preetha Appan 454b3a2a61 Pick up raft library change that fsyncs snapshot files correctly 2017-08-04 10:36:41 -05:00
Frank Schroeder 6346ac34cf
vendor: update hashicorp/go-discover to pull in hashicorp/go-discover#7 2017-08-03 21:00:37 +02:00
Frank Schroeder e7285af6cc vendor: add go-discover 2017-08-01 11:41:43 +02:00
Preetha Appan b841c99b87 Govendor update go-memdb and go-immutable-radix to pick up changes for DeletePrefix 2017-07-25 17:28:43 -05:00
James Phillips 31a7701891 Updates memberlist to pick up Lifeguard research findings. (#3287)
See https://www.hashicorp.com/blog/making-gossip-more-robust-with-lifeguard/.
2017-07-17 12:54:17 -07:00
Preetha Appan c4e8dfe554 Update raft library to pick up cleanup of temporary snapshot files 2017-07-11 08:22:57 -05:00
Frank Schroeder be782ae45e Pull in vendor updates 2017-07-07 09:22:34 +02:00
James Phillips 0e7c2f9e7f memberlist: Monkey patch memberlist to fix port 0 behavior.
https://github.com/hashicorp/memberlist/pull/128
2017-07-07 09:22:34 +02:00
Frank Schroeder 8ab88976cf serf: monkey patch data race in github.com/hashicorp/serf
https://github.com/hashicorp/serf/pull/476

This should be replaced when the patch is merged upstream
and the library is upgraded.
2017-07-07 09:22:34 +02:00
Preetha Appan 6d172b7059 Update serf to pull in disk space failure recovery changes 2017-07-06 08:58:42 -05:00
James Phillips ae1c6fd2c0 Bumps Raft library. (#3201)
This picks up the fix for https://github.com/hashicorp/raft/issues/212,
which can cause out-of-date followers to get stuck in a loop trying to
sync because they don't discard old snapshot data.

There's some incidental reordering of the vendor.json since the last
update to that file was merged by hand.
2017-06-27 18:41:00 -07:00
James Phillips 42f60b04bb Revert "discover: move instance discover code into separate package (#3144)" (#3180)
This reverts commit 26bfb2d00a.
2017-06-23 01:38:55 -07:00
Kyle Havlovitz da97de42be vendor: update github.com/hashicorp/memberlist (#3176) 2017-06-22 14:44:46 -07:00
Frank Schroeder da01cd112e
vendor: update github.com/hashicorp/go-discover 2017-06-22 12:46:23 +02:00
Frank Schröder 26bfb2d00a discover: move instance discover code into separate package (#3144)
This patch moves the code that discovers instances from metadata
information to github.com/hashicorp/go-discover with
sub-packages for each provider.
2017-06-21 10:40:38 +02:00
Kyle Havlovitz 5d99ee80ca Add an option to disable keyring file (#3145)
Also disables keyring file in dev mode.
2017-06-15 15:24:04 -07:00
Kyle Havlovitz 62f72f104c Add settings for upshifting to encrypted gossip (#3079) 2017-05-30 08:51:37 -07:00
James Phillips 1021a62ddc
Pulls in Serf logger fix. 2017-05-25 22:02:09 -07:00
James Phillips 9aba84eb1e
Updates Serf to pick up small fixes and coordinate NaN/Inf defenses. 2017-05-25 16:16:37 -07:00
Sean Chittenden 41fe2e79cf
Update hashicorp/go-sockaddr to the latest version.
* Adds plural IP helpers (e.g. `GetPrivateIPs`, `GetPublicIPs`)
  hashicorp/go-sockaddr#11
* Adds subnet math hashicorp/go-sockaddr#8
* Fixes helper functions for dual-homed hosts hashicorp/go-sockaddr#10)
2017-05-23 16:47:17 -07:00
Frank Schroeder b36f56dc8e vendor: remove github.com/hashicorp/scada-client 2017-05-22 11:07:46 +02:00
Frank Schroeder 6eba69fbfe agent: drop atlas/scada code 2017-05-10 23:06:36 +02:00
James Phillips 3d43031fbf
Updates vendored Raft library.
This pulls in https://github.com/hashicorp/raft/pull/207 to get
support for the new-style peers.json recovery file.
2017-05-04 13:27:33 -07:00
Kyle Havlovitz ebef78dc71
Vendor the go-rootcerts lib for the client tls options 2017-04-14 13:46:19 -07:00
Kyle Havlovitz 390f41d8d5
Add advanced autopilot features 2017-03-22 15:25:16 -07:00
James Phillips 5dd60581f1
Updates memberlist to get NACK penalty improvements. 2017-03-17 15:28:12 -07:00
James Phillips f7c5541ed5
Updates memberlist to get new transport interface. 2017-03-16 16:57:28 -07:00
Kyle Havlovitz 07288a20a1
Tweak last_contact health logic for leader 2017-03-15 19:57:54 -07:00
James Phillips 1f6425124f
Updates hashicorp/go-immutable-radix to pick up leaf panic fixes.
This fixes #2724 by properly tracking leaf updates during very large
delete transactions.
2017-02-13 16:47:49 -08:00
Jeff Mitchell 44733caf5c Update unix dial functions to use DialContext with new go-cleanhttp 2017-02-10 21:11:21 -05:00
James Phillips fe3a4e87a2 Revert "Updates go-cleanhttp to get better tuning for newer Go versions." 2017-02-10 17:12:56 -08:00
James Phillips 43fa3f4d4d
Updates go-cleanhttp to get better tuning for newer Go versions. 2017-02-10 16:39:19 -08:00
James Phillips bc2a45a9de
Updates memberlist and Serf (and adds new dependencies).
This gets a number of improvements:

* Fixed a missing case where gossip would stop flowing to dead nodes for a short while.
* Uses the go-sockaddr library to look for private IP addresses, which prefers non-loopback
  private addresses over loopback ones when trying to automatically determine the advertise address.
* Properly seeds Go's random number generator using the seed library.
* Serf snapshots no longer have the executable bit set on thie file.
2017-02-08 13:56:07 -08:00
James Phillips 0797d4f92b
Updates Serf library to get relay fixes.
https://github.com/hashicorp/serf/pull/447
2017-02-06 08:57:36 -08:00
Kyle Havlovitz ed5bf524ba
Update serf deps 2017-02-01 20:57:37 -05:00
James Phillips 10f3bdf4ff
Updates go-immutable-radix and go-memdb to get fine-grained watches. 2017-01-25 09:58:22 -08:00
Sean Chittenden c91c7f7df9
Update `hashicorp/go-sockaddr` to account for `tun(4)` interfaces. 2017-01-17 12:37:56 -08:00
Kyle Havlovitz c3db65a7d8
vendor: Update go-memdb dependency 2017-01-09 11:23:09 -08:00
Kyle Havlovitz 42bc44634b
Update memberlist vendor deps 2016-12-13 18:53:40 -05:00
Kyle Havlovitz acc21cc5fe
Update memberlist vendor deps 2016-12-05 17:27:52 -05:00
Sean Chittenden 24192f4d48
Small vendor update for go-sockaddr: now able to filter by CIDR. 2016-12-03 01:21:34 +11:00
Sean Chittenden 594e75a301
Update Windows support. 2016-12-02 18:05:18 +11:00
Sean Chittenden 5fc97b997d
Fix compilation on Windows. 2016-12-02 17:04:28 +11:00
Sean Chittenden f3ed18e95f
Import github.com/hashicorp/go-sockaddr 2016-12-02 15:14:44 +11:00
James Phillips c07bdb173b Merge pull request #2555 from hashicorp/pr-2497-slackpad
Updates Circonus library and adds support for custom display name and tags.
2016-11-30 21:42:01 -08:00
James Phillips aa6e59dc9a
Cleans up go-msgpack vendoring. 2016-11-14 17:37:05 -08:00
Kyle Havlovitz b2cdba8fcf Update raft deps to fix snapshot races in -dev mode (#2498) 2016-11-09 17:10:03 -08:00
James Phillips 16f8e04bfe
Revert "Updates Circonus metrics library and adds support for display name and tags."
This reverts commit bd490ec937 from #2491.
2016-11-09 16:21:02 -08:00
matt maier bd490ec937 Updates Circonus metrics library and adds support for display name and tags.
* Update circonus-gometrics

`vendor circonus-labs/circonus-gometrics`
`vendor circonus-labs/circonus-gometrics/api`
`vendor circonus-labs/circonus-gometrics/checkmgr`
`vendor circonus-labs/circonusllhist`
`vendor hashicorp/go-retryablehttp`

* Update Circonus integration expose Check Display Name and Check Tags configuration options.

* Adds version info to docs for new Circonus options.
2016-11-09 13:26:43 -08:00
matt maier 101b2cd9da Update circonus-gometrics
`vendor circonus-labs/circonus-gometrics`
`vendor circonus-labs/circonus-gometrics/api`
`vendor circonus-labs/circonus-gometrics/checkmgr`
`vendor circonus-labs/circonusllhist`
`vendor hashicorp/go-retryablehttp`
2016-11-09 15:30:07 -05:00
Kyle Havlovitz 3be132863f Enable snapshots in dev mode (#2453) 2016-10-31 14:39:47 -04:00
James Phillips c01a3871c9 Adds support for snapshots and restores. (#2396)
* Updates Raft library to get new snapshot/restore API.

* Basic backup and restore working, but need some cleanup.

* Breaks out a snapshot module and adds a SHA256 integrity check.

* Adds snapshot ACL and fills in some missing comments.

* Require a consistent read for snapshots.

* Make sure snapshot works if ACLs aren't enabled.

* Adds a bit of package documentation.

* Returns an empty response from restore to avoid EOF errors.

* Adds API client support for snapshots.

* Makes internal file names match on-disk file snapshots.

* Adds DC and token coverage for snapshot API test.

* Adds missing documentation.

* Adds a unit test for the snapshot client endpoint.

* Moves the connection pool out of the client for easier testing.

* Fixes an incidental issue in the prepared query unit test.

I realized I had two servers in bootstrap mode so this wasn't a good setup.

* Adds a half close to the TCP stream and fixes panic on error.

* Adds client and endpoint tests for snapshots.

* Moves the pool back into the snapshot RPC client.

* Adds a TLS test and fixes half-closes for TLS connections.

* Tweaks some comments.

* Adds a low-level snapshot test.

This is independent of Consul so we can pull this out into a library
later if we want to.

* Cleans up snapshot and archive and completes archive tests.

* Sends a clear error for snapshot operations in dev mode.

Snapshots require the Raft snapshots to be readable, which isn't supported
in dev mode. Send a clear error instead of a deep-down Raft one.

* Adds docs for the snapshot endpoint.

* Adds a stale mode and index feedback for snapshot saves.

This gives folks a way to extract data even if the cluster has no
leader.

* Changes the internal format of a snapshot from zip to tgz.

* Pulls in Raft fix to cancel inflight before a restore.

* Pulls in new Raft restore interface.

* Adds metadata to snapshot saves and a verify function.

* Adds basic save and restore snapshot CLI commands.

* Gets rid of tarball extensions and adds restore message.

* Fixes an incidental bad link in the KV docs.

* Adds documentation for the snapshot CLI commands.

* Scuttle any request body when a snapshot is saved.

* Fixes archive unit test error message check.

* Allows for nil output writers in snapshot RPC handlers.

* Renames hash list Decode to DecodeAndVerify.

* Closes the client connection for snapshot ops.

* Lowers timeout for restore ops.

* Updates Raft vendor to get new Restore signature and integrates with Consul.

* Bounces the leader's internal state when we do a restore.
2016-10-25 19:20:24 -07:00
Adam Wolfe Gordon de4fcf9a4e vendor: Remove go-reap
go-reap is no longer used since we no longer reap child processes.
2016-10-04 09:41:29 -06:00
R.B. Boyer 1c4b4ac54f
Validate gossip encryption key before made persistent in local.keyring 2016-08-12 11:42:45 -07:00
James Phillips f1fbfb9423
Updates hashicorp/yamux. 2016-08-09 17:24:41 -07:00
James Phillips a07938dc45
Updates hashicorp/scada-client. 2016-08-09 17:24:40 -07:00
James Phillips 13f89e68c5
Updates hashicorp/memberlist. 2016-08-09 17:24:40 -07:00
James Phillips 3b9ab553b7
Updates hashicorp/logutils. 2016-08-09 17:24:40 -07:00
James Phillips ccb86d20b0
Updates hashicorp/go-uuid. 2016-08-09 17:24:40 -07:00
James Phillips 7aedab2407
Updates hashicorp/go-syslog. 2016-08-09 17:24:40 -07:00
James Phillips a4ad479ce1
Updates hashicorp/go-retryablehttp. 2016-08-09 17:24:39 -07:00
James Phillips 952cabfad4
Updates hashicorp/go-reap. 2016-08-09 17:24:39 -07:00
James Phillips df69b76972
Updates hashicorp/go-cleanhttp. 2016-08-09 17:24:39 -07:00
James Phillips 7b97b570f2
Updates hashicorp/go-immutable-radix and hashicorp/go-memdb. 2016-08-09 17:24:39 -07:00
James Phillips ce141896df
Updates hashicorp/hcl and hashicorp/hil.
This required a small mod to core Consul code to cope with an interface
change.
2016-08-09 17:24:13 -07:00
James Phillips 5dc9d92fe0
Removes some unused vendored dependencies. 2016-08-09 16:50:34 -07:00
James Phillips 1eca282bee
Updates hashicorp/golang-lru. 2016-08-09 16:26:59 -07:00
James Phillips cc1f709333
Vendors first stage branch of the v2 Raft library. 2016-08-08 19:19:17 -07:00
James Phillips 8ec559a235
Updates Serf to pick up intent queue fix.
This fixes #1062 by storing intents per-node instead of in a small, fixed-
size circular buffer.
2016-08-08 18:58:44 -07:00
James Phillips 2f3e346dc1 Updates armon/go-metrics and adds Circonus vendored libraries. 2016-07-19 16:54:21 -07:00
James Phillips a46ed7fa32 Updates go-immutable-radix to pull in caching fix. 2016-06-08 19:08:31 -07:00
James Phillips b5f1c41aef Updates serf to get health score in stats. 2016-06-08 17:20:12 -07:00
James Phillips 785cb70cd3 Updates to latest Serf/memberlist to get lifeguard and TCP joins over DNS. 2016-06-07 14:30:47 -07:00
James Phillips a8bafda8b6 Pulls in latest Serf to get flap metric. 2016-06-07 09:22:41 -07:00
Jeff Mitchell ebf7ea1d75 Use upstream high-level SCADA provider 2016-06-01 18:25:39 -04:00
Sean Chittenden bf8c860663 Update Serf to include `serf.NumNodes()` 2016-03-23 22:10:50 -07: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 d4b01a6c53 Updates vendored dependencies.
This removes some unused dependencies that I know we plan to re-add later,
but this makes for a clean `godep save` for now.
2016-03-07 10:45:39 -08:00
James Phillips 9139cee5e5 Updates memberlist to get goroutine leak fix for TCP pings. 2016-03-07 10:41:54 -08:00
Mat Schaffer 3142a51688 Metric name typo 2016-02-25 11:20:53 +09:00
Jeff Mitchell 14a3a14543 Update go-cleanhttp 2016-02-17 17:03:57 -05:00
Sean Chittenden 25b09713b9 Manage dependencies via Godep
Embrace the future and use Go 1.6's vendor support via Godep.

Go 1.5 users should `export GO15VENDOREXPERIMENT=1`
2016-02-12 16:50:37 -08:00