Commit Graph

1870 Commits

Author SHA1 Message Date
preetapan 73951d8319 Merge pull request #3494 from hashicorp/enforce_json_extension
Enforce json or hcl extension to Consul config files, updated unit tests
2017-09-25 17:30:33 -05:00
James Phillips 45646ac3f4 Bumps default Raft protocol to version 3. (#3477)
* Changes default Raft protocol to 3.

* Changes numPeers() to report only voters.

This should have been there before, but it's more obvious that this
is incorrect now that we default the Raft protocol to 3, which puts
new servers in a read-only state while Autopilot waits for them to
become healthy.

* Fixes TestLeader_RollRaftServer.

* Fixes TestOperator_RaftRemovePeerByAddress.

* Fixes TestServer_*.

Relaxed the check for a given number of voter peers and instead do
a thorough check that all servers see each other in their Raft
configurations.

* Fixes TestACL_*.

These now just check for Raft replication to be set up, and don't
care about the number of voter peers.

* Fixes TestOperator_Raft_ListPeers.

* Fixes TestAutopilot_CleanupDeadServerPeriodic.

* Fixes TestCatalog_ListNodes_ConsistentRead_Fail.

* Fixes TestLeader_ChangeServerID and adjusts the conn pool to throw away
sockets when it sees io.EOF.

* Changes version to 1.0.0 in the options doc.

* Makes metrics test more deterministic with autopilot metrics possible.
2017-09-25 15:27:04 -07:00
Preetha Appan a286ad7533 Enforce json or hcl extension to Consul config files, updated unit tests 2017-09-25 17:17:12 -05:00
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
James Phillips 00605c0214
Shows the segment name in the keyring API and command output. 2017-09-07 12:17:39 -07:00
James Phillips d12b172a5d
Remaps servers to "<all>" only when listing multiple segments. 2017-09-05 13:50:38 -07:00
James Phillips 1a117ba0a8
Makes the all segments query explict, and the default for `consul members`. 2017-09-05 12:22:20 -07:00
James Phillips 74d635e9c6
Simplifies members command to not fetch segments. 2017-09-05 11:46:44 -07:00
Kyle Havlovitz f8261330f0
Remove duplicate error message 2017-09-01 10:18:43 -07:00
Kyle Havlovitz 62102a537e
Organize segments for a cleaner split between enterprise and OSS 2017-08-31 17:39:46 -07:00
Kyle Havlovitz 7e565d7338
Fix some inconsistencies with segment logic and comments 2017-08-30 17:43:46 -07:00
Kyle Havlovitz 21513b0393
Update coord display in ui to account for segments 2017-08-30 11:58:29 -07:00
Kyle Havlovitz d129767657
Add agent.segment interpolation to prepared queries 2017-08-30 11:58:29 -07:00
Kyle Havlovitz 2ada0439d4
Add rpc_listener option to segment config 2017-08-30 11:58:29 -07:00
James Phillips b1a15e0c3d
Adds open source side of network segments (feature is Enterprise-only). 2017-08-30 11:58:29 -07:00
Frank Schroeder 831d84c940 build: make tests independent of build tags
When the metadata server is scanning the agents for potential servers
it is parsing the version number which the agent provided when it
joined. This version number has to conform to a certain format, i.e.
'n.n.n'. Without this version number properly set some tests fail with
error messages that disguise the root cause.

The default version number is currently set to 'unknown' in
version/version.go which does not parse and triggers the tests to fail.
The work around is to use a build tag 'consul' which will use the
version number set in version_base.go instead which has the correct
format and is set to the current release version.

In addition, some parts of the code also require the version number to
be of a certain value. Setting it to '0.0.0' for example makes some
tests pass and others fail since they don't pass the semantic check.

When using go build/install/test one has to remember to use '-tags
consul' or tests will fail with non-obvious error messages.

Using build tags makes the build process more complex and error prone
since it prevents the use of the plain go toolchain and - at least in
its current form - introduces subtle build and test issues. We should
try to eliminate build tags for anything else but platform specific
code.

This patch removes all references to specific version numbers in the
code and tests and sets the default version to '9.9.9' which is
syntactically correct and passes the semantic check. This solves the
issue of running go build/install/test without tags for the OSS build.
2017-08-30 13:40:18 +02:00
wuxin d6729243eb fix command/kv_import.go help text (#3387) 2017-08-10 09:17:37 +02:00
Frank Schröder 4b642fed2f agent: honor deprecated flags for retry-join-{ec2,azure,gce} (#3384) 2017-08-09 16:18:30 -07:00
Frank Schroeder 1acff3533e
agent: move agent/consul/structs to agent/structs 2017-08-09 14:32:12 +02:00
Kyle Havlovitz d5634fe2a8
Add support for labels/filters from go-metrics 2017-08-08 01:45:10 -07:00
Frank Schroeder 2fac427cd4 agent: use github.com/hashicorp/go-discover
Replace the provider specific node discovery code
with go-discover to support AWS, Azure and GCE.

Fixes #3282
2017-08-01 11:41:43 +02:00
Preetha Appan 840749db7e Fix comments, and remove redundant TestConfig init from a couple of unit tests 2017-07-28 10:40:43 -05:00
Preetha Appan aa98aeb4b1 Moved handling advertise address to readConfig and out of the agent's constructor, plus unit test fixes 2017-07-27 22:06:31 -05:00
Preetha Appan 25acd1534a Move go-socketaddr template parsing into config package to make it happen before creating a new agent. Also removed redundant parsetemplate calls from agent.go. 2017-07-27 16:17:35 -05:00
James Phillips 08a8d9f2a7 command/lock: Add -child-exitcode, return 2 on child error (#3329)
* Exit 2 if -child-exit-code and the child returned with an error.
* There is no platform independent way to check the exact return code of
* the child, so on error always return 2.
* Closes #947
* Closes #1503
2017-07-26 22:09:19 -07:00
Kyle Havlovitz 9268849d11
Add UpgradeVersionTag to autopilot get/set commands 2017-07-18 14:01:04 -07:00
James Phillips 1791d99a10 Adds new config to make script checks opt-in, updates documentation. (#3284) 2017-07-17 11:20:35 -07:00
James Phillips 86918be323
Sort tags so output is deterministic. 2017-07-14 17:00:08 -07:00
Seth Vargo afd83a9705 Add catalog CLI functions (#3204) 2017-07-14 12:45:08 -07:00
Frank Schroeder 406dc2ead8 command: make TestExecCommandRun_CrossDC more resilient
Wait after WAN join that both members see each other.
2017-07-07 09:22:34 +02:00
James Phillips f1bded7c5e
Removes unneeded shutdown channel in config reading tests. 2017-06-25 10:39:51 -07:00
James Phillips 6977e40077 Fixes watch tracking during reloads and fixes address issue. (#3189)
This patch fixes watch registration through the config file and a broken log line when the watch registration fails. It also plumbs all the watch loading through a common function and tweaks the
unit test to create the watch before the reload.
2017-06-24 12:52:41 -07:00
James Phillips 380c8b957d Changes host-based node IDs from opt-out to opt-in. (#3187) 2017-06-24 09:36:53 -07:00
Jared Wasinger 3cdde3c7ca Warn when attempting to bootstrap an even number of nodes (#3158)
* Warn when attempting to bootstrap an even number of nodes.  Addresses #1282
* add more detailed warning for two server case
2017-06-21 15:36:55 -07:00
Frank Schroeder ea5b0f2c7c agent: fix 'consul leave' shutdown race (#2880)
When the agent is triggered to shutdown via an external 'consul leave'
command delivered via the HTTP API then the client expects to receive a
response when the agent is down. This creates a race on when to shutdown
the agent itself like the RPC server, the checks and the state and the
external endpoints like DNS and HTTP.

This patch splits the shutdown process into two parts:

 * shutdown the agent
 * shutdown the endpoints (http and dns)

They can be executed multiple times, concurrently and in any order but
should be executed first agent, then endpoints to provide consistent
behavior across all use cases. Both calls have to be executed for a
proper shutdown.

This could be partially hidden in a single function but would introduce
some magic that happens behind the scenes which one has to know of but
isn't obvious.

Fixes #2880
2017-06-21 05:52:51 +02:00
James Phillips 6b2ad20131
Moves flag slice helper into configutil. 2017-06-20 12:52:35 -07:00
James Phillips 902f1ce16f Moves config util helpers into their own package. (#3165) 2017-06-20 10:49:37 -07: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
Frank Schroeder 1c75cf1af5 pkg refactor
command/agent/*                  -> agent/*
    command/consul/*                 -> agent/consul/*
    command/agent/command{,_test}.go -> command/agent{,_test}.go
    command/base/command.go          -> command/base.go
    command/base/*                   -> command/*
    commands.go                      -> command/commands.go

The script which did the refactor is:

(
	cd $GOPATH/src/github.com/hashicorp/consul
	git mv command/agent/command.go command/agent.go
	git mv command/agent/command_test.go command/agent_test.go
	git mv command/agent/flag_slice_value{,_test}.go command/
	git mv command/agent .
	git mv command/base/command.go command/base.go
	git mv command/base/config_util{,_test}.go command/
	git mv commands.go command/
	git mv consul agent
	rmdir command/base/

	gsed -i -e 's|package agent|package command|' command/agent{,_test}.go
	gsed -i -e 's|package agent|package command|' command/flag_slice_value{,_test}.go
	gsed -i -e 's|package base|package command|' command/base.go command/config_util{,_test}.go
	gsed -i -e 's|package main|package command|' command/commands.go

	gsed -i -e 's|base.Command|BaseCommand|' command/commands.go
	gsed -i -e 's|agent.Command|AgentCommand|' command/commands.go
	gsed -i -e 's|\tCommand:|\tBaseCommand:|' command/commands.go
	gsed -i -e 's|base\.||' command/commands.go
	gsed -i -e 's|command\.||' command/commands.go

	gsed -i -e 's|command|c|' main.go
	gsed -i -e 's|range Commands|range command.Commands|' main.go
	gsed -i -e 's|Commands: Commands|Commands: command.Commands|' main.go

	gsed -i -e 's|base\.BoolValue|BoolValue|' command/operator_autopilot_set.go
	gsed -i -e 's|base\.DurationValue|DurationValue|' command/operator_autopilot_set.go
	gsed -i -e 's|base\.StringValue|StringValue|' command/operator_autopilot_set.go
	gsed -i -e 's|base\.UintValue|UintValue|' command/operator_autopilot_set.go

	gsed -i -e 's|\bCommand\b|BaseCommand|' command/base.go
	gsed -i -e 's|BaseCommand Options|Command Options|' command/base.go
	gsed -i -e 's|base.Command|BaseCommand|' command/*.go
	gsed -i -e 's|c\.Command|c.BaseCommand|g' command/*.go
	gsed -i -e 's|\tCommand:|\tBaseCommand:|' command/*_test.go
	gsed -i -e 's|base\.||' command/*_test.go

	gsed -i -e 's|\bCommand\b|AgentCommand|' command/agent{,_test}.go
	gsed -i -e 's|cmd.AgentCommand|cmd.BaseCommand|' command/agent.go

	gsed -i -e 's|cli.AgentCommand = new(Command)|cli.Command = new(AgentCommand)|' command/agent_test.go
	gsed -i -e 's|exec.AgentCommand|exec.Command|' command/agent_test.go
	gsed -i -e 's|exec.BaseCommand|exec.Command|' command/agent_test.go
	gsed -i -e 's|NewTestAgent|agent.NewTestAgent|' command/agent_test.go
	gsed -i -e 's|= TestConfig|= agent.TestConfig|' command/agent_test.go
	gsed -i -e 's|: RetryJoin|: agent.RetryJoin|' command/agent_test.go

	gsed -i -e 's|\.\./\.\./|../|' command/config_util_test.go

	gsed -i -e 's|\bverifyUniqueListeners|VerifyUniqueListeners|' agent/config{,_test}.go command/agent.go
	gsed -i -e 's|\bserfLANKeyring\b|SerfLANKeyring|g' agent/{agent,keyring,testagent}.go command/agent.go
	gsed -i -e 's|\bserfWANKeyring\b|SerfWANKeyring|g' agent/{agent,keyring,testagent}.go command/agent.go
	gsed -i -e 's|\bNewAgent\b|agent.New|g' command/agent{,_test}.go
	gsed -i -e 's|\bNewAgent|New|' agent/{acl_test,agent,testagent}.go

	gsed -i -e 's|\bAgent\b|agent.&|g' command/agent{,_test}.go
	gsed -i -e 's|\bBool\b|agent.&|g' command/agent{,_test}.go
	gsed -i -e 's|\bConfig\b|agent.&|g' command/agent{,_test}.go
	gsed -i -e 's|\bDefaultConfig\b|agent.&|g' command/agent{,_test}.go
	gsed -i -e 's|\bDevConfig\b|agent.&|g' command/agent{,_test}.go
	gsed -i -e 's|\bMergeConfig\b|agent.&|g' command/agent{,_test}.go
	gsed -i -e 's|\bReadConfigPaths\b|agent.&|g' command/agent{,_test}.go
	gsed -i -e 's|\bParseMetaPair\b|agent.&|g' command/agent{,_test}.go
	gsed -i -e 's|\bSerfLANKeyring\b|agent.&|g' command/agent{,_test}.go
	gsed -i -e 's|\bSerfWANKeyring\b|agent.&|g' command/agent{,_test}.go

	gsed -i -e 's|circonus\.agent|circonus|g' command/agent{,_test}.go
	gsed -i -e 's|logger\.agent|logger|g' command/agent{,_test}.go
	gsed -i -e 's|metrics\.agent|metrics|g' command/agent{,_test}.go
	gsed -i -e 's|// agent.Agent|// agent|' command/agent{,_test}.go
	gsed -i -e 's|a\.agent\.Config|a.Config|' command/agent{,_test}.go

	gsed -i -e 's|agent\.AppendSliceValue|AppendSliceValue|' command/{configtest,validate}.go

	gsed -i -e 's|consul/consul|agent/consul|' GNUmakefile

	gsed -i -e 's|\.\./test|../../test|' agent/consul/server_test.go

	# fix imports
	f=$(grep -rl 'github.com/hashicorp/consul/command/agent' * | grep '\.go')
	gsed -i -e 's|github.com/hashicorp/consul/command/agent|github.com/hashicorp/consul/agent|' $f
	goimports -w $f

	f=$(grep -rl 'github.com/hashicorp/consul/consul' * | grep '\.go')
	gsed -i -e 's|github.com/hashicorp/consul/consul|github.com/hashicorp/consul/agent/consul|' $f
	goimports -w $f

	goimports -w command/*.go main.go
)
2017-06-10 18:52:45 +02:00
Frank Schroeder 9ceef2b32e test: move discover tests 2017-06-10 18:52:45 +02:00
Frank Schroeder d2ee591fbf use 'c' as command receiver for simple commands 2017-06-10 18:52:45 +02:00
Frank Schroeder 902f4caff2 agent: move watch plans into agent 2017-06-10 18:52:45 +02:00
preetapan 2de032125b Fixed regression with dns server start condition (#3137) 2017-06-09 15:50:06 -07:00
Seth Vargo 89f16984f9
Simplify 2017-06-09 14:55:04 -04:00
Seth Vargo ee1b5d5024
Update comment 2017-06-09 14:51:34 -04:00
Seth Vargo 532f8d1435
Parse values given to ?passing in the API
This PR fixes GH-2212 in the most backwards-compatible way I can think
of. If the user does not pass a value for `?passing`, it's assumed to be
true, which mirrors the current behavior. However, if the user passes
any value for passing, that value is parsed as a bool using strconv.

It's important to note that this is technically a breaking change.
Previously using `?passing=false` would return only passing nodes. While
this behavior is obviously incorrect, it was the previous behavior. We
should call this out very clearly in the CHANGELOG.
2017-06-09 14:36:00 -04:00
James Phillips 86713c1b8a
Opens up timing bound on flaky test. 2017-06-08 21:37:52 -07:00
James Phillips 66ec9c7a7d
Fixes HTTP header compare by including standard headers. 2017-06-08 14:10:46 -07:00
Frank Schroeder b5f8d6f9fd agent: fix time.Duration parsing
The duration can be passed as a string, a float64 or a time.Duration
and this patch handles this properly.
2017-06-08 22:42:49 +02:00
Frank Schroeder 39d33c2fdc
agent: log events and exit code to the log file
This patch logs the signals, events, errors and the exit
code to the log file instead of printing it on the console.
This should provide a more complete picture for debugging.
2017-06-08 10:07:55 +02:00
Frank Schroeder 4a223111d2
log: use prefix [ERR] instead of [ERROR] 2017-06-08 09:50:47 +02:00
James Phillips fa8a26ad54
Updates static assets to latest. 2017-06-07 21:16:59 -07:00
James Phillips a09eed585e Merge pull request #3121 from hashicorp/increase-graceful-timeout
agent: increase graceful shutdown timeout
2017-06-07 10:42:19 -07:00
Frank Schroeder fe69de3bba
agent: increase graceful shutdown timeout
When triggering a leave through an INT/TERM signal the hard-coded
timeout of 5 seconds is too short to complete the leave successfully.
Therefore, the agent always times out.

This value should probably configurable.
2017-06-07 13:12:34 +02:00
Frank Schroeder 46c055d57b
agent: log differnt shutdown stages
Log the different code paths during shutdown.
2017-06-07 13:11:04 +02:00
Frank Schröder 825f72f5ef agent: support custom header and method for http checks (#3106)
This patch adds support for custom headers and
method for HTTP checks.

Fixes #2474
Fixes #2657
Fixes #3106
2017-06-07 01:11:56 +02:00
Frank Schroeder 94b39557e8 test: refactor TestDecodeConfig test
This patch refactors the multiple tests for
DecodeConfig into a single table-driven test
that tests most fields individually.
2017-06-04 23:55:12 +02:00
Frank Schroeder 325f82972a test: Fix TestAgent_Reload
This test was still referring to cmd.agent which has been removed.
2017-06-04 22:45:40 +02:00
James Phillips 240413f5d6 Merge pull request #3105 from hashicorp/test-stability
Tweaks things for better test stability.
2017-06-03 10:09:12 -07:00
Frank Schroeder 51e0e158f1 agent: fix graceful http server shutdown 2017-06-03 19:08:50 +02:00
Frank Schroeder ae711c3b04 agent: cleanup run method 2017-06-03 19:08:50 +02:00
Frank Schroeder b203ffab29 agent: move registerWatches out of the run method 2017-06-03 19:08:50 +02:00
Frank Schroeder 11245e53a7 agent: move telemetry out of the run method 2017-06-03 19:08:50 +02:00
Frank Schroeder 84f5e8c3ab agent: move update check out of the run method 2017-06-03 19:08:50 +02:00
Frank Schroeder 96d8035adc agent: simplify signal handling 2017-06-03 19:08:50 +02:00
Frank Schroeder 34fd31b7b1 agent: move config reloading into the agent 2017-06-03 19:08:50 +02:00
Frank Schroeder aa1519c9f7 agent: move parseMetaPair to config and export 2017-06-03 19:08:50 +02:00
Frank Schroeder cb98754cd6 agent: remove agent from command
Decouple command and agent a bit more.
2017-06-03 19:08:50 +02:00
Frank Schroeder d977aa1fe7 agent: move retry join into agent 2017-06-03 19:08:50 +02:00
Frank Schroeder 55a513da2e agent: add GossipEncrypted function
Remove dead code and expose a GossipEncrypted() method
on the agent instead of accessing the internal delegate.
2017-06-03 19:08:50 +02:00
James Phillips b0b5df579f
Cleans up an unrelated vet error. 2017-06-02 21:07:15 -07:00
James Phillips b4b5036dfb
Adds back the port shuffle on agent start retries. 2017-06-02 20:53:20 -07:00
Frank Schroeder 375825f34c Do not recurse when the service address is a local cname
Fixes #2795
2017-06-01 18:20:31 +02:00
Frank Schroeder 9956bc9b47 agent: LastContact cannot be negative (#3067)
The X-Consul-LastContact header cannot be negative.

Fixes #3067
2017-06-01 18:20:12 +02:00
Frank Schroeder db15cd847a
test: replace one more BoolFalse with agent.Bool() 2017-05-31 11:41:17 +02:00
Frank Schroeder dcc68f0f85
test: we will not use dev mode for testing for now 2017-05-31 11:34:00 +02:00
Frank Schroeder f89ae9f7e7
test: stagger retry attempts of TestAgent.Start 2017-05-31 11:33:25 +02:00
Frank Schroeder bdfed817ee
test: make TestAgent setup reusable
Pick the random ports only once and try starting with them
a number of times so that the configuration can be re-used.
This is because the ports are written into the data files
and a subsequent agent reading the files needs to have the
same ports.

For the same reason we do not remove the data directory on
every attempt since this makes it impossible to re-read the
data files.
2017-05-31 11:32:31 +02:00
Frank Schroeder 4034d0ac0b
agent: use agent logger for consul client and deps 2017-05-31 11:05:02 +02:00
Frank Schroeder c1e6a77c75
test: start secondary agents also via TestAgent 2017-05-31 10:56:19 +02:00
Frank Schroeder a9451d596f
agent: set tcpKeepAliveListener when there is no error 2017-05-31 10:24:32 +02:00
Frank Schroeder 345666bdb6
test: use test name as log prefix 2017-05-31 09:54:09 +02:00
Frank Schroeder d6c7404b34
agent: simplify shutdown timeout logging
Note that we are currently timing out every time. This still
needs to be investigated.
2017-05-31 09:41:58 +02:00
Frank Schroeder 30ba712857
agent: set proto to http since we are logging it now 2017-05-31 09:41:16 +02:00
Frank Schroeder ceda18366f
test: Use Bool() instead of &BoolTrue/False since 2017-05-31 09:21:01 +02:00
Frank Schroeder ec729693d7
Address review comments 2017-05-31 01:05:21 +02:00
Frank Schroeder 26200929c1
agent: start HTTPS only if there is a cert and key 2017-05-31 00:29:29 +02:00
Frank Schroeder b6c69ebf5d
agent: refactor DNS and HTTP server
* refactor DNS server to be ready for multiple bind addresses
* drop tcpKeepAliveListener since it is default for the HTTP servers
* add startup timeout watcher for HTTP servers identical to DNS server
2017-05-31 00:29:29 +02:00
Frank Schroeder aa92adcdd5
test: increase sleep time for test 2017-05-31 00:29:28 +02:00
Frank Schroeder f498f24032
test: allow tests to control anti-entropy syncs 2017-05-31 00:29:28 +02:00
Frank Schroeder eea16e1640
test: run mock dns recursors on random ports 2017-05-31 00:29:28 +02:00
Frank Schroeder 6148910399
test: skip tests that use cmd.Run until signal handling is fixed 2017-05-31 00:29:28 +02:00
Frank Schroeder 56cf015117
test: add test for starting/stopping lots of agents 2017-05-31 00:29:28 +02:00
Frank Schroeder 7c5892a196
test: use UniqueID prefix for check tests to unify log output 2017-05-31 00:29:28 +02:00
Frank Schroeder 0a31094e06
test: improve TestAgent
* don't use retry to try restarting the agent
  this caused some issues when the startup would fail in
  a separate go routine

* clear out the data directory on every retry since the ports
  are stored in the raft data files

* set a unique id for every agent to allow for tracking of
  concurrent output
2017-05-31 00:29:28 +02:00
Frank Schroeder 10540f8d5f
agent: fix logging
* use agent logger for consul/serf/raft/dns/agent/...
* support optional id for concurrent tests
2017-05-31 00:29:27 +02:00
Frank Schroeder fe777852cd
test: call t.Fatal() from main go routine 2017-05-31 00:29:27 +02:00
Frank Schroeder 3e39f04527
dns: do not log socket close during shutdown 2017-05-31 00:29:27 +02:00
Frank Schroeder 1df74e36bd
agent: print more useful shutdown message 2017-05-31 00:29:27 +02:00
Frank Schroeder 2e14c09447
test: start sync after agent start 2017-05-31 00:29:27 +02:00
Frank Schroeder 5b5566d916
test: add test name to output 2017-05-31 00:29:27 +02:00
Frank Schroeder 28ed8f1847
test: perform blocking query on agent 2017-05-31 00:29:27 +02:00
Frank Schroeder ebc0c80f08
test: parallelize dns test 2017-05-31 00:29:26 +02:00
Frank Schroeder 72c214b908
test: fix failing test 2017-05-31 00:29:26 +02:00
Frank Schroeder c5f565ee1a
test: remove output to stdout 2017-05-31 00:29:26 +02:00
Frank Schroeder 8f943542b0
test: use cli.NewMockUi instead of new(cli.MockUi)
Use the constructor function to prevent a nil panic
if there was no write to the output buffers.
2017-05-31 00:29:26 +02:00
Frank Schroeder 0325a42089
test: fix data race with endpoints 2017-05-31 00:29:26 +02:00
Frank Schroeder e16589c079
agent: shutdown delegate if created
When the TestAgent shuts down a half-started agent
the delegate may not have been created at this point.
2017-05-31 00:29:26 +02:00
Frank Schroeder 632f837c98
agent: shutdown dns servers on error 2017-05-31 00:29:26 +02:00
Frank Schroeder 8c1a668481
test: Shutdown half-started agent before retrying 2017-05-31 00:29:25 +02:00
Frank Schroeder 584693482d
test: fix data race in MockNotify
42 -> 32 data races
2017-05-31 00:29:25 +02:00
Frank Schroeder 9509ab463c
test: run command tests in parallel 2017-05-31 00:29:25 +02:00
Frank Schroeder 3658d4d428
test: address pull request comments 2017-05-31 00:29:25 +02:00
Frank Schroeder 0f912c8aad
test: remove ACL options from default test config 2017-05-31 00:29:25 +02:00
Frank Schroeder bc47972696
test: allocate ports in blocks of 10 2017-05-31 00:29:24 +02:00
Frank Schroeder 53c1c86ab3
test: refactor command tests to use TestAgent 2017-05-31 00:29:24 +02:00
Frank Schroeder 24eec373de
test: retry a bit more often 2017-05-31 00:29:24 +02:00
Frank Schroeder 659d7dbbde
agent: rename *Config vars to 'cfg' 2017-05-31 00:29:24 +02:00
Frank Schroeder e86d34685f
agent: rename *Command vars to 'cmd'
'c' is ambigious and it conflicts with 'config'.
2017-05-31 00:29:24 +02:00
Frank Schroeder 141efd9588
test: rename *Config vars to 'cfg'
'c' is ambigous since Command also uses this
and we want to use 'config' as a package name.
2017-05-31 00:29:24 +02:00
Frank Schroeder 06677708cf
test: use less aggressive retry for agent startup 2017-05-31 00:29:24 +02:00
Frank Schroeder 47501309ae
test: use system temp dir for TestAgent 2017-05-31 00:29:24 +02:00
Frank Schroeder 0c905a0df8
test: a.config -> a.Config 2017-05-31 00:29:23 +02:00
Frank Schroeder 0be63d7060
test: refactor httpTest with TestAgent 2017-05-31 00:29:23 +02:00
Frank Schroeder 308f9929b3
test: run agent tests in parallel
This brings down the test run from 108 sec to 15 sec.

There is an occasional port conflict because of the nature
the next port is chosen. So far it seems rare enough to live
with it.
2017-05-31 00:29:23 +02:00
Frank Schroeder 23a6ff383c
agent: refactor tests for TestAgent
Refactored tests that use

 * makeAgentXXX
 * makeDNSServerXXX
 * makeHTTPServerXXX
2017-05-31 00:29:23 +02:00
Frank Schroeder b5b3aa1376
agent: add TestAgent to replace other mechanisms
TestAgent will replace the following mechanisms to
start test agents in subsequent requests:

 * makeAgentXXX
 * makeDNSServerXXX
 * makeHTTPServerXXX
 * testServer
 * httpTest
2017-05-31 00:29:23 +02:00
Frank Schroeder 3865f14a25
agent: simplify agent creation
This patch creates an agent with just a config struct
and allows for other fields to be set as required.
2017-05-31 00:29:23 +02:00
Frank Schroeder 82650f73e3
agent: move http/dns endpoints into agent
Move the HTTP and DNS endpoints into the agent and control
their lifespan via the agent.

This removes the requirement to manage HTTP and DNS servers
indpendent of the agent since the agent is mostly useless
without an endpoint and the endpoints without the agent.
2017-05-31 00:29:23 +02:00
Frank Schroeder 74be791f9b
agent: fix comment 2017-05-31 00:29:22 +02:00
Frank Schroeder b42916e1ff
agent: simplify socket address helper 2017-05-31 00:29:22 +02:00
Frank Schroeder c44e41a741
agent: replace goto with local function 2017-05-31 00:29:22 +02:00
Frank Schroeder 327401e7ee
agent: inline uiDir field
uiDir can be inlined as agent.config.UIDir
2017-05-31 00:29:22 +02:00
Frank Schroeder 8f381d62f6
agent: drop logOutput parameter
agent.logOutput is identical to logOutput
2017-05-31 00:29:22 +02:00
Frank Schroeder c47db2c922
agent: drop config argument
agent.config and config are identical.
2017-05-31 00:29:22 +02:00
Kyle Havlovitz 62f72f104c Add settings for upshifting to encrypted gossip (#3079) 2017-05-30 08:51:37 -07:00
James Phillips 385c9522b3 Removes obsolete agent API documentation. 2017-05-26 10:24:45 -07:00
Frank Schroeder 91c5c9a2d0
doc: update comments and run goimports 2017-05-24 10:20:28 +02:00
Michael Leow deb206b7d7
agent: add RetryJoin support for Azure
Pull #2978 from leowmjw/develop

Resolves #2978
2017-05-24 10:15:38 +02:00
James Phillips 9aa232ea2e Merge pull request #2901 from deckarep/consul-ensure-exit-non-zero-on-timeout
Ensure to exit with a non-zero status code when a timeout and all jobs are not completed.
2017-05-18 10:25:50 -04:00
Frank Schroeder 8ad66f4bea
agent: support custom check id and name
This patch adds support for a custom check id and name when
registering a service.

This is achieved by adding a CheckID and a Name field to the
CheckType structure which is used to register checks with a
service and when returning health check definitions.

CheckDefinition is a superset of CheckType which duplicates
some of the fields of CheckType. This patch decouples these
two structures by removing the embedding of CheckType in
CheckDefinition.

Fixes #3047
2017-05-17 20:17:08 +02:00
Frank Schroeder ad40a855bd agent: move isAddrANY to separate package 2017-05-15 22:44:43 +02:00
Frank Schroeder e2c37b47ee agent: Replace client/server with delegate interface
This patch adds a new internal interface clientServer
which defines the common methods of consul.Client and
consul.Server. This allows to replace the following
code

    if a.server != nil {
        a.server.do()
    } else {
        a.client.do()
    }

with

    a.delegate.do()

In case a specific type is required a type check can
be performed:

    if srv, ok := a.delegate.(*consul.Server); ok {
        srv.doSrv()
    }
2017-05-15 18:35:38 +02:00
Frank Schroeder 41f01a0cfc agent: allow "::" as IPv6 bind address
Fixes #2285
2017-05-15 17:51:33 +02:00
Frank Schroeder 65b5c51ec7 test: add helper for ioutil.TempDir/TempFile
This creates a simplified helper for temporary directories and files.
All path names are prefixed with the name of the current test.
All files and directories are stored either in /tmp/consul-test
or /tmp if the former could not be created.

Using the system temp dir breaks some tests on macOS where the unix
socket path becomes too long.
2017-05-12 22:12:47 +02:00
Frank Schroeder 3d54fe51ba test: lower wait time for some tests 2017-05-12 22:12:47 +02:00
Frank Schroeder 98f6e3b7c5 test: suppress osx firewall warning
macOS displays a firewall warning dialog when an unsigned
application is trying to bind to a non-loopback address.

This patch updates some test configurations to ensure binding
to a loopback address where possible to suppress these warnings.
2017-05-12 22:12:47 +02:00
Frank Schroeder 3522a41bad test: include test name in temp file/dir
This helps identifying hanging tests by looking
at the process list.
2017-05-12 22:12:47 +02:00
Frank Schroeder db3599762f test: drop unused code 2017-05-11 17:04:36 +02:00
Frank Schroeder 914a83cae0 agent: use bind address as src unless INADDR_ANY
Use the bind address as source address for outgoing
RPC connections unless it is INADDR_ANY.

The current code uses the advertise address which will
not work in certain environments where the advertise
address is not routable in the network of the agent,
e.g. NAT environment, container... After all, that is
the purpose of the advertise address.

See #2822
2017-05-11 00:34:14 +02:00
Frank Schroeder e6c6f8cedd agent: use helper for INADDR_ANY 2017-05-11 00:34:14 +02:00
Kyle Havlovitz 5bab68b9bb Add a path for transitioning to TLS on an existing cluster (#3001)
Fixes #1705
2017-05-10 14:25:48 -07:00
Frank Schroeder 6eba69fbfe agent: drop atlas/scada code 2017-05-10 23:06:36 +02:00
Frank Schroeder 5328609d59 test: refactor TestAgent_Leave_ACLDeny to use only one server 2017-05-10 17:42:38 +02:00
Frank Schroeder a60f508880 test: use isPermissionDenied 2017-05-10 17:42:38 +02:00
Frank Schroeder 66bc2cbabc test: replace blocks and comments with sub-tests 2017-05-10 17:42:38 +02:00
Frank Schroeder d711b9bba0 test: inline request body encoding 2017-05-10 17:42:38 +02:00
Frank Schroeder 82cb9c50ad test: add helper for permission denied check 2017-05-10 17:42:38 +02:00
Frank Schroeder 1e89692cc1 test: drop error check on http.NewRequest
Most URLs are static so the error check is redundant.
The subsequent test wouldn't work if the url is wrong.
2017-05-10 17:42:38 +02:00
Frank Schroeder 6fa76fd90f
agent: Disallow :: or [::] as advertise or advertise-wan address 2017-05-09 17:56:16 +02:00
Frank Schroeder 8ad52ee9b5
agent: Disallow :: and [::] as service address 2017-05-09 17:56:15 +02:00
Frank Schroeder e365ef12cf
agent: Disallow 0.0.0.0 as advertise or advertise-wan address
Fixes #2961
2017-05-09 17:56:15 +02:00
Frank Schroeder 73a31b9bfe
agent: Disallow 0.0.0.0 as service address
Fixes #2961
2017-05-09 17:56:15 +02:00
James Phillips 33a7b8e401
Tweaks some tests that were having a hard time in Travis CI and
bumps up the default retry time.
2017-05-09 06:48:26 -07:00
James Phillips efff41a8b2
Updates built-in static assets for web UI. 2017-05-08 19:50:54 -07:00
Frank Schroeder 2794db5aac
test: Fix badly formatted retry.Run tests 2017-05-05 17:07:03 +02:00
Frank Schroeder 9c86d5c764
test: convert remaining WaitForResult tests 2017-05-05 17:07:03 +02:00
James Phillips ddfa57765c
retry: Removes the description parameter. 2017-05-05 17:07:03 +02:00
James Phillips 2de1cd5a4a
test: Turns off ACLs for catalog and health WAN translation tests.
Since this was doing registration to a foreign DC, it needs extra time
for the route to the ACL datacenter to be set up. ACLs aren't part of
this test, so by disabling them we make this more reliable and converge
faster than if we had added a retry.
2017-05-05 17:07:03 +02:00
James Phillips 888fa5cad6
test: Moves a variable closer to where it's used. 2017-05-05 17:07:03 +02:00
James Phillips 0daacfe5e5
test: Turns down server health interval for faster convergence.
This fixes the autopilot tests.
2017-05-05 17:07:02 +02:00
Frank Schroeder 21a82a0a16
test: Refactor WaitForResult tests with retry
Refactor tests that use testutil.WaitForResult to use retry.

Since this requires refactoring the test functions in general this patch
also shows the use of the github.com/pascaldekloe/goe/verify library
which provides a good mechanism for comparing nested data structures.
Instead of just converting the tests from testutil.WaitForResult to
retry the tests that performing a nested comparison of data structures
are converted to the verify library at the same time.
2017-05-05 17:07:02 +02:00
Frank Schroeder f39c604cd7
Fix imports 2017-05-05 17:07:00 +02:00
Frank Schroeder 8c2b261c61 Use bind address as source for outgoing connections (#2822)
This patch configures consul to use the bind address as the
source address for outgoing connections.

Fixes #2822
2017-05-04 01:41:47 +02:00
Frank Schroeder fb83790cb9 Do not modify config after creation II
Move code for finding the advertise address via a
template into consulConfig() so that the config
object is not modified after creation.
2017-05-04 01:41:47 +02:00
Frank Schroeder a235986a28 Do not modify config after creation
Make sure the RPCAdvertise address is always set
so that the configuration does not have to be modified
after creation.
2017-05-04 01:41:47 +02:00
Frank Schroeder a226edd4a9 Move GCE discovery code to command/agent/config_gce.go 2017-05-04 01:41:47 +02:00
Frank Schroeder 7f73f14260 Move AWS discovery code to command/agent/config_aws.go 2017-05-04 01:41:47 +02:00
Frank Schroeder 78fc19c48c Move verifyUniqueListeners to command/agent/config.go 2017-05-04 01:41:47 +02:00
Frank Schroeder d34ba3e823 Cleanup agent config 2017-05-04 01:41:47 +02:00
Damon Buckwalter 98407322a6 Itty bitty typo 2017-05-02 16:08:07 -07:00
James Phillips 6382f95898
Updates static assets to pick up #2712. 2017-05-02 10:52:06 -07:00
Kyle Havlovitz cd56a5ebdd Add separate option for verifying incoming HTTPS traffic (#2974)
* Add separate option for verifying incoming HTTPS traffic
2017-04-28 16:15:55 -07:00
Frank Schroeder 84d6ac2d51 api: Return empty list instead of nil 2017-04-28 15:00:08 -07:00
Frank Schroeder 9685bdcd0b api: Add ServiceTags to Health state endpoint (#153)
This patch adds the ServiceTags to the /v1/health/state/<state>
endpoint.

Fixes #153
2017-04-28 15:00:08 -07:00
Frank Schroeder 7075695627 Faster dev server startup
This patch reduces the timeouts for the development
server so that it starts up almost instantly.
2017-04-28 14:43:44 -07:00
Frank Schroeder 48fa2962eb Revert "test: Run command/agent tests in parallel"
This reverts commit 17be40a733.
2017-04-27 14:39:04 -07:00
Frank Schroeder 0cb4295182 test: Do not run RetryJoin tests in parallel
I am suspecting port conflicts with the agents
that are started. This needs further investigation.
2017-04-27 14:39:04 -07:00
Frank Schroeder 7281b4291a test: Speedup session renew tests 2017-04-27 10:34:30 -07:00
Frank Schroeder 37c180a920 test: Speedup Retry*Join tests 2017-04-27 10:34:30 -07:00
Frank Schroeder 17be40a733 test: Run command/agent tests in parallel 2017-04-27 10:34:30 -07:00
Kyle Havlovitz b70e419aeb Add TLS cipher suite options and CA path support (#2963)
This patch adds options to configure the available
TLS cipher suites and adds support for a path
for multiple CA certificates.

Fixes #2959
2017-04-27 01:29:39 -07:00
James Phillips 59c4128deb
Updates compiled static assets. 2017-04-25 13:54:03 -07:00
Frank Schroeder 3403cd4372 golint: Fix existing comments
This needs more work.
2017-04-25 09:26:13 -07:00
Frank Schroeder 3e00e36f41 golint: Untangle if blocks with return in else 2017-04-25 09:26:13 -07:00
Frank Schroeder d7e23857ad golint: No stutter 2017-04-25 09:26:13 -07:00
Frank Schroeder cf3ec1cf5c golint: Rename fields and structs 2017-04-25 09:26:13 -07:00
Frank Schroeder 5a3961f31f golint: Replace a += 1 with a++ 2017-04-25 09:26:13 -07:00
Frank Schroeder 6688a510e1 golint: Consistent receiver name
Ensure the receiver name is consistent
2017-04-25 09:26:13 -07:00
Frank Schroeder 8bb7792799 golint: Drop the unused value from range
for i, _ := range foo -> for i := range foo
2017-04-25 09:26:13 -07:00
Frank Schroeder eddb1af603 Remove duplicate constants
This patch removes duplicate internal copies of constants in the structs
package which are also defined in the api package. The api.KVOp type
with all its values for the TXN endpoint and the api.HealthXXX constants
are now used throughout the codebase.

This resulted in some circular dependencies in the testutil package
which have been resolved by copying code and constants and moving the
WaitForLeader function into a separate testrpc package.
2017-04-20 09:54:49 -07:00
Frank Schroeder ee5b06a231 Use fmt.Fprint/Fprintf/Fprintln
Used the following rewrite rules:

gofmt -w -r 'resp.Write([]byte(fmt.Sprintf(a, b, c, d))) -> fmt.Fprintf(resp, a, b, c, d)' *.go
gofmt -w -r 'resp.Write([]byte(fmt.Sprintf(a, b, c))) -> fmt.Fprintf(resp, a, b, c)' *.go
gofmt -w -r 'resp.Write([]byte(fmt.Sprintf(a, b))) -> fmt.Fprintf(resp, a, b)'  *.go
gofmt -w -r 'resp.Write([]byte(fmt.Sprintf(a))) -> fmt.Fprint(resp, a)' *.go
gofmt -w -r 'resp.Write([]byte(a + "\n")) -> fmt.Fprintln(resp, a)' *.go
gofmt -w -r 'resp.Write([]byte(a)) -> fmt.Fprint(resp, a)' *.go
2017-04-20 09:02:59 -07:00
Kyle Havlovitz f25cac4c8f Show raft protocol in list-peers command (#2929) 2017-04-19 15:01:40 -07:00
Kyle Havlovitz 29a4a42f17
Fix help text on client cert/key options 2017-04-18 16:30:20 -07:00
mckennajones a489f2b734
Added check to see if ui and ui-dir flags are both specified 2017-04-17 17:25:57 -07:00
Kyle Havlovitz b1d98522ee
Fix help text for -ca-path 2017-04-14 14:44:45 -07:00
Kyle Havlovitz ae6bf56ee1
Add tls client options to api/cli 2017-04-14 13:37:29 -07:00
James Phillips fb089e2bbb Merge pull request #2842 from vaLski/supress_sigpipe_logging
Supress signal logging on SIGPIPE. Should address #2768
2017-04-13 16:52:29 -07:00
James Phillips 4de270326e
Updates static assets to pick up #2899. 2017-04-13 14:40:16 -07:00
James Phillips 2843da5cd9 Merge pull request #2904 from hashicorp/non-host-id
Adds a new -disable-host-node-id option to help when testing with containers.
2017-04-13 10:49:05 -07:00
James Phillips fa04c24978
Adds a new -disable-host-node-id option to help when testing with containers.
Fixes #2877.
2017-04-12 22:07:18 -07:00
Ralph Caraveo 7ab576891e Ensure to exit with a non-zero status code when a timeout occurs and we don't complete all the jobs. 2017-04-12 17:51:16 -07:00
Ralph Caraveo 87f1a1a3ee Fixed spelling for consul kv get command --help comments. 2017-04-12 17:31:57 -07:00
Alex Dadgar 7f6d95f1c9 Hash host ID so its stable and well distributed
This PR takes the host ID and runs it through a hash so that it is well
distributed. This makes it so that machines that report similar host IDs
are easily distinguished.

Instances of similar IDs occur on EC2 where the ID is prefixed and on
motherboards created in the same batch.
2017-04-10 11:57:24 -07:00
James Phillips 86870ae51d Merge pull request #2854 from hashicorp/remote-exec
Changes `disable_remote_exec` default to true so remote exec is opt-in.
2017-03-30 10:29:09 -07:00
Kyle Havlovitz da9c825592
Add CLI/API endpoints for removing peer by ID 2017-03-30 10:13:32 -07:00
James Phillips 7e2dcb61bf
Changes `disable_remote_exec` default to true so remote exec is opt-in. 2017-03-30 09:43:32 -07:00
James Phillips 11ee9a9e72
Disables agent-level enforcement on Consul agents unless acl_datacenter is set. 2017-03-29 12:24:42 -07:00
vaLentin chernoZemski 1e5163d241 Supress signal logging on SIGPIPE. Should address #2768
When consul-template is communicating with consul and the job is done, consul thread receives SIGPIPE.

This cause the logs to be filled "Caught signal: broken pipe" and they does not bring any usefull info with them.

Skipping those.
2017-03-29 09:46:58 +03:00
James Phillips 59a599a14b
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 7ce7d157da
Fixes up some broken unit tests. 2017-03-24 17:35:07 -07:00
James Phillips 8940d1c3fe
Keeps the service and check tokens around for deregistration.
We fixed a few related issues while we were in here. We now only let
services register checks with a matching token, and we also close out
service and check delete operations if the catalog deregister claims
it doesn't know about the ID of the service or check being deleted.
2017-03-24 17:15:20 -07:00
James Phillips 4d3f3ea8d2
Changes verson 8 ACLs to opt-out. 2017-03-24 12:12:24 -07:00
Seth Vargo 0170a28ec9
Use new APIs 2017-03-23 18:48:13 -04:00
Seth Vargo 4622ac634b
Re-add RPC parsing
This makes the upgrade path a bit nicer, since people will likely have
older configurations. This prints out a warning instead of just failing
if the old rpc addr or ports definition is in the config.
2017-03-23 17:10:14 -04:00
James Phillips 00a5fc2947
Renames some operator unit tests. 2017-03-22 19:26:43 -07:00
Kyle Havlovitz 390f41d8d5
Add advanced autopilot features 2017-03-22 15:25:16 -07:00
James Phillips 3b3cb0d07b 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 2696dd52b8
Updates to latest built-in static assets. 2017-03-20 10:18:47 -07:00
James Phillips a8ee32cbdd
Fixes RTT command to only compare coordinates in the same area. 2017-03-16 16:42:19 -07:00
James Phillips 1091c7314e
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
Kyle Havlovitz 09e2663d10 Merge pull request #2802 from hashicorp/f-autopilot-improvements
Fix an issue with changing server ID when re-joining
2017-03-15 20:26:16 -07:00
Kyle Havlovitz 5353221666
Reorganized cluster health check loop and logic 2017-03-15 18:27:17 -07:00
Kyle Havlovitz 51b11cd344
Fix an issue with changing server IDs and add a few UX enhancements around autopilot features 2017-03-15 16:09:55 -07:00
James Phillips 26dddb428c
Forces user-supplied node IDs to lower case for consistency. 2017-03-13 19:51:56 -07:00
Kyle Havlovitz 7608a3c15f
Use defers for WaitGroup and Ticker stop 2017-03-10 12:29:03 -08:00
Kyle Havlovitz 9b4497de09
Cleaned up and reorganized some autopilot-related code 2017-03-09 18:21:40 -08:00
Kyle Havlovitz c3d638e2c5
Move RaftStats to Status endpoint 2017-03-07 13:58:06 -08:00
Kyle Havlovitz fb259e3d04
Merge branch 'master' into f-autopilot-2 2017-03-06 16:02:19 -08:00
Kyle Havlovitz 2eefe3ca5b
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
Sean Chittenden a791de3ecf Revert "Change `ClientAddr` to default to `BindAddr` when not present." 2017-03-06 13:32:43 -08:00
Sean Chittenden beae5c6bba
Change `ClientAddr` to default to `BindAddr` when not present.
With this change, it is now possible to only specify the `-bind` or
`bind_addr` attributes and get a functioning consul agent.
2017-03-04 20:52:52 -08:00
James Phillips 3103f7f673 Merge pull request #2690 from zeroae/f-simple-rfc2782
RFC 2782 support with optional .service tag
2017-03-02 14:49:36 -08:00
Kyle Havlovitz ab6c49ab4c Merge pull request #2771 from hashicorp/f-autopilot
Autopilot dead server cleanup, config, and raft version compatibility
2017-02-28 15:04:16 -08:00
Kyle Havlovitz 5f125324db Merge pull request #2774 from hashicorp/f-cli-deprecation-docs
Add CLI RPC deprecation section to docs
2017-02-28 14:59:48 -08:00
Kyle Havlovitz 92c8b9c3a0
Rename DeadServerCleanup and make wording adjustments 2017-02-28 14:45:21 -08:00
Kyle Havlovitz f389b59fd5
Fix up command and api tests 2017-02-28 14:12:55 -08:00
Kyle Havlovitz 9221aed856
Remove the RPC client interface and update docs 2017-02-28 13:41:09 -08:00
Sean Chittenden cbbbf5ee39
Follow the lead in 6fc901a8f3 and set the default `DisplayName` to `Consul` 2017-02-26 12:26:14 -08:00
Kyle Havlovitz 211995bc3c
Convert agent command to use base.Command 2017-02-24 18:11:05 -08:00
Kyle Havlovitz 5429e8ce66
Add cli docs and minor test/comment tweaks 2017-02-24 16:55:44 -08:00
Kyle Havlovitz bf735aa008
Use BoolValue for flag type 2017-02-24 16:00:39 -08:00
Kyle Havlovitz 2ea36d7bd4
Merge branch 'master' into f-autopilot 2017-02-24 15:55:18 -08:00
Kyle Havlovitz c1f776c78b
Added operator autopilot subcommands 2017-02-24 15:54:49 -08:00
Kyle Havlovitz c2e7f45002
Add CAS capability to autopilot config endpoint 2017-02-24 13:08:49 -08:00
James Phillips e37f66d0b2
Exports config functions from base. 2017-02-23 21:08:43 -08:00
James Phillips a48ecf56a9
Exports visit function from base. 2017-02-23 21:01:06 -08:00
Kyle Havlovitz 81c7a0299e
Add state store table and endpoints for autopilot 2017-02-23 20:32:13 -08:00
Kyle Havlovitz 950a9d2212
Move raft_protocol out of autopilot config 2017-02-23 13:08:40 -08:00
Kyle Havlovitz b20fd222f6
Add raft version 2/3 compatibility 2017-02-22 12:53:32 -08:00
Kyle Havlovitz c8d0273f1b
Condense raft subcommand into one doc page 2017-02-16 11:44:14 -08:00
Kyle Havlovitz e85b401eb9
Split operator raft command into subcommands 2017-02-15 13:53:34 -08:00
Jeff Mitchell 73035f9ef8 Update TestHTTPServer_UnixSocket with DialContext 2017-02-10 21:29:42 -05:00
Kyle Havlovitz 466e39d27a Merge pull request #2732 from hashicorp/f-validate-command
Deprecate configtest and add validate command
2017-02-10 20:34:09 -05:00
Kyle Havlovitz 2aebff3bd3
Add -quiet flag to validate 2017-02-10 20:14:22 -05:00
Kyle Havlovitz c9abafab92
Update docs and give better error for unknown client scheme 2017-02-10 19:55:54 -05:00
Kyle Havlovitz eee5eb3fb8
Update website docs for validate command 2017-02-10 19:38:38 -05:00
Kyle Havlovitz fe7b26a996
Deprecate the configtest command and add the validate command 2017-02-10 19:21:51 -05:00
Kyle Havlovitz 9e23dabbfa
Allow internal watches to use https and unix sockets 2017-02-10 18:38:39 -05:00
Kyle Havlovitz a7a6ee9f4c
Allow prefixing -http-addr with http/https schemes 2017-02-10 18:25:46 -05:00
Kyle Havlovitz a8eaad3ba4
Remove cli rpc functions 2017-02-10 13:57:02 -05:00
Kyle Havlovitz 152b71ec89
Formatting fix in members output 2017-02-10 13:02:37 -05:00
Kyle Havlovitz 55ee1b0aed
Merge branch 'master' into f-cli-rework-3 2017-02-09 21:24:27 -05:00
Kyle Havlovitz bad037fb58
Cleanup and formatting adjustments 2017-02-09 20:49:17 -05:00
Kyle Havlovitz ea66375063
Convert watch command to use base.Command 2017-02-09 20:36:01 -05:00
Kyle Havlovitz edbb0ce0b8
Add missing doc page for version command 2017-02-09 20:08:25 -05:00
Kyle Havlovitz aa0d2502f8
Convert snapshot command to use base.Command 2017-02-09 20:00:38 -05:00
Kyle Havlovitz 8236af47ba
Convert rtt command to use base.Command 2017-02-09 19:38:06 -05:00
Kyle Havlovitz 8c14f93fb1
Convert reload command to use base.Command 2017-02-09 19:32:22 -05:00
Kyle Havlovitz 369b4b6d73
Convert operator command to use base.Command 2017-02-09 18:19:34 -05:00
Kyle Havlovitz be17779c42
Convert monitor command to use base.Command 2017-02-09 17:31:52 -05:00
Kyle Havlovitz 14415741a3
Convert members command to use base.Command 2017-02-09 17:12:47 -05:00
Kyle Havlovitz 6c4d4f9a32
Convert maint command to use base.Command 2017-02-09 17:06:19 -05:00
Kyle Havlovitz ccb193f77f
Convert leave command to use base.Command 2017-02-09 16:48:12 -05:00
Kyle Havlovitz 746dbc1c51
Make join exit non-zero if no nodes were joined 2017-02-08 19:45:13 -05:00
Kyle Havlovitz 14a7ffc098
Convert kv commands to use base.Command 2017-02-08 19:26:24 -05:00
Kyle Havlovitz abdf1fbab3
Convert keyring command to use base.Command 2017-02-08 18:25:47 -05:00
Kyle Havlovitz d67151908d
Convert keygen command to use base.Command 2017-02-08 17:19:17 -05:00
Kyle Havlovitz 8775b031d3
Convert join command to use base.Command 2017-02-08 17:14:02 -05:00
Kyle Havlovitz a3d02a4cbc
Convert info command to use base.Command 2017-02-08 16:58:04 -05:00
Kyle Havlovitz aa1c464961
Convert exec command to use base.Command 2017-02-08 16:57:46 -05:00
Kyle Havlovitz 8985398c7e
Convert event command to use base.Command 2017-02-08 16:56:58 -05:00
Kyle Havlovitz 0b85bbfed1
Small tweaks to base command 2017-02-07 20:56:49 -05:00
Kyle Havlovitz 197dc10a7f
Add utility types to enable checking for unset flags 2017-02-07 20:14:41 -05:00
Kyle Havlovitz 49d2ce1c3d
Move command Meta to base.Command and split http options 2017-02-07 19:16:41 -05:00
Kyle Havlovitz edc353914d
Fix the check for displaying the command options 2017-02-06 23:45:58 -05:00
Kyle Havlovitz 8009432b1b
Convert configtest and force-leave commands to use Meta 2017-02-06 20:50:51 -05:00
Kyle Havlovitz 3d09fb880f
Merge branch 'master' into f-cli-rework 2017-02-06 13:46:44 -05:00
Kyle Havlovitz 5d888f5303
Added -relay-factor param to keyring operations 2017-02-01 21:53:29 -05:00
Kyle Havlovitz a533e255ab Merge pull request #2699 from hashicorp/f-tls-min-version
Add TLSMinVersion to config options
2017-02-01 16:31:53 -05:00
Kyle Havlovitz 07ba3ddb6e
Add TLSMinVersion to config options 2017-02-01 16:20:33 -05:00
Sean Chittenden fd2ae702c9
Re-cherry-pick 71d807f607 and e2320d69b6. 2017-02-01 10:27:04 -08:00
James Phillips e9cc66ab51
Fixes issue with missing CNAME for services with non-IP addresses set in SRV responses. 2017-01-31 20:57:50 -08:00
Patrick Sodré c135c08fb2 Simple RFC 2782 support with optional .service tag
Add support for SRV queries of names matching:
_<service>._<protocol>.[.service][.datacenter]<.domain>
2017-01-30 19:46:02 -05:00
James Phillips f0f52bd5f6
Redacts AWS join credientials from /v1/agent/self output. 2017-01-25 21:01:07 -08:00
James Phillips eaa8fde298
Updates a comment to point to new blockingQuery function. 2017-01-25 09:58:22 -08:00
James Phillips 4c1a156417
Pulls in latest static asset updates. 2017-01-25 09:57:56 -08:00
Kyle Havlovitz bbfd25b530
Fix test import 2017-01-23 21:34:01 -05:00
Kyle Havlovitz a55968f009
Merge branch 'master' into f-prepared-query-nodemeta 2017-01-23 20:17:48 -05:00
Kyle Havlovitz 3f3d7f9891
Add tests for node meta in prepared queries and update docs 2017-01-23 19:17:30 -05:00
David Black 507e6769f8 s/givne/given/ 2017-01-19 09:16:31 -08:00
James Phillips 6ca0173907
Adds catalog support for node IDs. 2017-01-18 14:26:42 -08:00
James Phillips e719ff8ef1
Adds a test to make sure we get the same ID on the second run. 2017-01-18 09:52:34 -08:00
James Phillips bd605e330c
Adds basic support for node IDs. 2017-01-17 22:47:59 -08:00
James Phillips 8d57727ff0 Merge pull request #2639 from tanuck/master
Standardize the case of all check log messages
2017-01-17 09:07:45 -08:00
James Phillips 25fb498b20 Merge pull request #2578 from ybubnov/concurrent-safe-notification-mock
Concurrent-safe notification mock
2017-01-17 09:01:43 -08:00
Kyle Havlovitz 5acd69b4fc
Add node metadata filtering to remaining health/catalog endpoints 2017-01-13 20:08:43 -05:00
Kyle Havlovitz fb68a6bab0
Style tweaks and vendor.json cleanup 2017-01-12 16:49:44 -05:00
Kyle Havlovitz 5ddea8a5df
Merge branch 'master' into f-gce-discovery 2017-01-11 22:57:07 -05:00
Kyle Havlovitz dbc72eaac0
Condense gce discovery logging a bit 2017-01-11 22:37:22 -05:00
Kyle Havlovitz 23ce10f889 Merge pull request #2643 from hashicorp/f-node-metadata
Node metadata
2017-01-11 20:29:24 -05:00
Kyle Havlovitz 7f91cd12f4
Add -node-meta to agent command line options 2017-01-11 16:09:04 -05:00
Kyle Havlovitz c9e430c396
Validate metadata config earlier and handle multiple filters 2017-01-11 15:12:03 -05:00
Andrew Glen-Young 01de3b3cb9 Pedantic typo fix 2017-01-10 15:44:32 -05:00
Kyle Havlovitz 03273e4ed2
Fix formatting 2017-01-09 13:49:33 -08:00
Kyle Havlovitz 84504a20fc
Add meta key validations and more tests 2017-01-09 11:21:49 -08:00
Kyle Havlovitz e44bcb9716
Add tests for node metadata functionality 2017-01-05 17:21:56 -08:00
Kyle Havlovitz 52d6fd831e
Add support for setting node metadata fields 2017-01-05 14:10:26 -08:00
James Phillips 66f3a0f1c3 Merge pull request #2635 from hashicorp/kv-put-crash
cli: Fix panic on empty data argument to `kv put`
2017-01-05 09:57:59 -08:00
James Nugent 19921290c4 cli: Fix printf format in KV Export Test
Fix vet issue:

command/kv_export_test.go:48: arg code for printf verb %s of wrong type:
int
2017-01-05 09:28:12 -06:00
James Nugent ae83b71b08 cli: Fix panic on empty data argument to `kv put`
Passing in an empty quoted argument from the shell currently panics as
we never check the length being greater than 0 prior to indexing into
the first rune, as illustrated in the test in this commit.

We also fix the panic, treating an empty string for data as equivalent
to not having passed it in the first place.
2017-01-05 08:02:38 -06:00
James Nugent d4e8c8a2c1 cli: Add KV `export` and `import`
This commit adds two new commands to the Consul KV CLI, which export and
import a JSON formatted representation of the Consul KV tree. It is
useful to migrate parts of the KV tree between unrelated Consul
clusters, and could also be used for initial data population of the KV
store.
2017-01-05 07:57:38 -06:00
James Tancock 5151c64f54 Standardize the case of all check log messages 2017-01-05 08:34:20 +00:00
James Nugent 2e8f440ac7 cli: Add -base64 option to `consul kv put`
This commit adds a -base64 option to the consul kv put command, which
base 64 decodeds the data prior to writing it. This can be used in
conjunction with `consul kv get -base64 key`.
2017-01-04 16:12:21 -06:00
James Nugent 5334649355 Merge pull request #2631 from hashicorp/kv-get-base64
cli: Add -base64 option to `consul kv get`
2017-01-04 16:00:27 -06:00
James Nugent b79296ac70 cli: Add -base64 option to `consul kv get`
This commit adds a `-base64` option to the `consul kv get` command,
which base 64 encodes the output such that it can be processed by
terminal tools in the event that the data is binary. The flag defaults
to false.
2017-01-04 15:41:40 -06:00
Kyle Havlovitz 8494b06ce0
Don't error if the given data-dir doesn't exist 2016-12-15 12:55:21 -05:00
James Phillips d6dc6a1fcc
Adds exception for data-dir check in -dev mode.
This was changed in #2529.
2016-12-14 22:11:16 -08:00
James Phillips 2f9c05a75b
Updates web assets to match latest. 2016-12-14 21:08:17 -08:00
James Phillips a67d308175 Merge pull request #2594 from hashicorp/acl-complete
Adds complete ACL support for /v1/agent endpoints.
2016-12-14 20:49:00 -08:00
James Phillips ededf330ba
Adds complete ACL support for listing events. 2016-12-14 19:42:37 -08:00
James Phillips babb0a1235
Adds remaining unit tests for agent ACL vet and filter functions. 2016-12-14 19:28:09 -08:00
James Phillips 171ec6e487
Fixes a race in the monitor endpoint test that would cause panics. 2016-12-14 18:13:30 -08:00
Kyle Havlovitz cb96aa8eb3 Merge pull request #2529 from mckennajones/bug/1838
Give a better error message when data-dir is not a directory
2016-12-14 20:21:10 -05:00
Kyle Havlovitz daa5ba87d4 Handle error from stat on data-dir and shorten error message 2016-12-14 20:06:00 -05:00
James Phillips 4ffd824547
Adds a leader wait when testing with ACLs. 2016-12-14 16:18:17 -08:00
James Phillips 03f40116f4
Adds complete ACL coverage for non-utility agent endpoints.
This is a checkpoint - we need to complete some unit tests for agent/acl.go.
2016-12-14 14:53:40 -08:00
Kyle Havlovitz 7fbac3ffad Merge pull request #2553 from mckennajones/bug/ignoresigpipe
Ignore sigpipe signals
2016-12-14 15:36:26 -05:00
Kyle Havlovitz 7f5f1fed81
Add a notice about deprecation of atlas features 2016-12-14 15:13:51 -05:00
James Phillips 01b6766099
Adds complete ACL support for agent utility endpoints. 2016-12-14 11:12:55 -08:00