Commit Graph

6089 Commits

Author SHA1 Message Date
Frank Schroeder b083ce17c7
Revert "agent: fix 'consul leave' shutdown race (#2880)"
This reverts commit 90c83a32b5.
2017-06-19 21:34:08 +02:00
Frank Schroeder 90c83a32b5 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. Ideally, the external endpoints
should be shutdown before the internal state but if the goal is to
respond reliably that the agent is down then this is not possible.

This patch splits the agent shutdown into two parts implemented in a
single method to keep it simple and unambiguos for the caller. The first
stage shuts down the internal state, checks, RPC server, ...
synchronously and then triggers the shutdown of the external endpoints
asychronously. This way the caller is guaranteed that the internal state
services are down when Shutdown returns and there remains enough time to
send a response.

Fixes #2880
2017-06-19 21:24:26 +02:00
Kyle Havlovitz 5473255f98 Update encryption.html.md 2017-06-16 12:54:25 -07:00
Preetha Appan b3b2e9dcb4 Added unit test to verify consistentRead method behavior 2017-06-16 11:58:12 -05:00
Preetha Appan 44f5086873 Code review feedback, fixed major logic bug 2017-06-16 10:49:54 -05:00
Preetha Appan 72af7b9bc4 Redo bug fix for stale reads on server startup, leveraging RPCHOldtimeout instead of maxQueryTime, plus tests 2017-06-15 22:41:30 -05:00
Kyle Havlovitz f021c778ad Create CHANGELOG.md 2017-06-15 15:29:58 -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
vijay rama raju samanuri 5507a310dd Typo in CHANGELOG (#3149) 2017-06-15 07:23:21 -07:00
James Phillips 3f2aac0124 Create CHANGELOG.md 2017-06-14 16:25:20 -07:00
Seth Vargo a8f1e7ebf9 Add EDNS0 support (#3131)
This is a refactor of GH-1980. Originally I tried to do a straight
rebase, but the code has changed too much.
2017-06-14 16:22:54 -07:00
preetapan 695fde556f Merge pull request #3143 from hashicorp/fix_build
Fixed static asset build target and checked in new executable for ass…
2017-06-12 11:00:27 -07:00
Preetha Appan cf5006c4f4 Fixed static asset build target and checked in new executable for assetfs 2017-06-12 12:57:02 -05:00
Scott Woods 7696a9f8be Fix bad copy/paste (#3139)
Description was probably originally copied from the "delete" request.
2017-06-10 14:46:25 -07:00
Frank Schroeder b3aee2fc56 simplify main.go 2017-06-10 18:52:45 +02: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
James Phillips 3835788d6a Update CHANGELOG.md 2017-06-09 21:11:16 -07:00
James Phillips 1f040b6a7a Create CHANGELOG.md 2017-06-09 15:51:50 -07:00
preetapan 2de032125b Fixed regression with dns server start condition (#3137) 2017-06-09 15:50:06 -07:00
Seth Vargo 401380ae41
Update CHANGELOG 2017-06-09 15:13:28 -04:00
Seth Vargo 864358caf0 Merge pull request #3136 from hashicorp/sethvargo/api-ux
Parse values given to ?passing in the API
2017-06-09 15:10:23 -04: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 7e4406e5b9
Puts the tree into 0.9.0 dev mode. 2017-06-09 08:27:15 -07:00
James Phillips c5596e3574
Bumps the website version to 0.8.4. 2017-06-09 08:03:24 -07:00
James Phillips f4360770d8
Release v0.8.4 2017-06-09 07:44:26 -07:00
James Phillips d968d8b648
Puts the tree into 0.8.4. release mode. 2017-06-09 07:34:00 -07:00
James Phillips 076417064f
Removes obsolete Windows build scripts. 2017-06-09 01:13:28 -07:00
James Phillips de74e430f3
Removes obsolete Windows batch file and instructions.
We officially just cross-compile to Windows, and soon will have the normal
Go build working. Since we no longer have any cgo dependencies, none of this
complexity is really needed.
2017-06-09 01:11:38 -07:00
James Phillips 34704c7080 Merge pull request #3133 from hashicorp/less-parallel
Makes tests less parallel and relaxes timing.
2017-06-09 00:02:35 -07:00
James Phillips 86713c1b8a
Opens up timing bound on flaky test. 2017-06-08 21:37:52 -07:00
James Phillips a87c9b528e
Removes t.Parallel() on any consul package tests that use a test server. 2017-06-08 21:34:07 -07:00
James Phillips 2039ae903b Merge pull request #3128 from hashicorp/broken-tests
Fixes HTTP header compare by including standard headers.
2017-06-08 14:11:15 -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
James Phillips 76e8ed07b0 Create CHANGELOG.md 2017-06-08 13:16:32 -07:00
Preetha Appan 51b0f991c3 Updated changelog 2017-06-08 13:04:53 -07:00
preetapan 06edd1eb4f Merge pull request #3127 from hashicorp/s3_encrypt_doc
Added documentation for new s3 server side encryption
2017-06-08 12:44:53 -07:00
Preetha Appan ec0cfae5ab Added documentation for new s3 server side encryption 2017-06-08 11:39:10 -07:00
James Phillips 22e89abd80 Merge pull request #3126 from hashicorp/doc-eureka
website: Add a vs Eureka. Fixes #1295
2017-06-08 11:04:28 -07:00
Armon Dadgar df55d9fbb0 website: Add a vs Eureka. Fixes #1295 2017-06-08 11:00:30 -07:00
James Phillips 967a7a400b Create CHANGELOG.md 2017-06-08 07:25:19 -07:00
James Phillips 0a3bcf0f41 Create CHANGELOG.md 2017-06-08 07:24:42 -07:00
James Phillips 08f60eb64f Create CHANGELOG.md 2017-06-08 07:22:29 -07:00
James Phillips 4a6b7f6c61 Merge pull request #3124 from hashicorp/log-signal-events
agent: log events and exit code to the log file
2017-06-08 07:21:24 -07:00
Seth Vargo 138f1c12d9
Update middleman 2017-06-08 08:49:43 -04:00