Frank Schroeder
27bc11f005
ae: make control flow more explicit
2017-10-23 10:56:05 +02:00
Frank Schroeder
29435004f6
ae: fix typo in constructor name
2017-10-23 10:56:05 +02:00
Frank Schroeder
1bb1a6787e
ae: add test for resume triggering SyncChanges
2017-10-23 10:56:05 +02:00
Frank Schroeder
6de645a8b8
ae: add test for ifNotPausedRun
2017-10-23 10:56:05 +02:00
Frank Schroeder
4f79ee3188
ae: make stagger function pluggable for testing
2017-10-23 10:56:05 +02:00
Frank Schroeder
5d6089b6fa
ae: restore previous pause/resume behavior
2017-10-23 10:56:04 +02:00
Frank Schroeder
6064a2a764
ae: ensure that syncs are blocked when paused
2017-10-23 10:56:04 +02:00
Frank Schroeder
f187c37c27
local state: rename Add{Check,Service}State to Set{Check,Service}State
2017-10-23 10:56:04 +02:00
Frank Schroeder
209e67b2f9
local state: move Metadata methods together
2017-10-23 10:56:04 +02:00
Frank Schroeder
9513a042be
local state: update documentation of updateSyncState
2017-10-23 10:56:04 +02:00
Frank Schroeder
2e3b72d2c3
local state: update comments
2017-10-23 10:56:04 +02:00
Frank Schroeder
da604495a0
local state: address review comments
...
* move non-blocking notification mechanism into ae.Trigger
* move Pause/Resume into separate type
2017-10-23 10:56:04 +02:00
Frank Schroeder
c39bc770b3
local state: refactor TestAgentAntiEntropy_EnableTagOverride
...
Make intent clearer by being more explicit and adding some comments.
Use verify.Values to compare service entries.
2017-10-23 10:56:04 +02:00
Frank Schroeder
e1358a541d
local state: fix TestAgentAntiEntropy_EnableTagOverride
...
The test had a race condition where it relied on the first service to be
synced to the remote catalog which sometimes failed.
2017-10-23 10:56:04 +02:00
Frank Schroeder
b3195006b1
local state: rename tests
2017-10-23 10:56:04 +02:00
Frank Schroeder
d9a4b440a8
local state: drop retry loops from tests
...
Since the tests are now using synchronous calls for state syncing
we no longer need to use retry loops to wait for the changes to
propagate.
2017-10-23 10:56:04 +02:00
Frank Schroeder
462de8b2cb
agent: skip non-sensical TestCatalogRegister
...
It is not clear what this test is supposed to verify.
2017-10-23 10:56:04 +02:00
Frank Schroeder
32c2d1b217
local state: fix anti-entropy state tests
...
The anti-entropy tests relied on the side-effect of the StartSync()
method to perform a full sync instead of a partial sync. This lead to
multiple anti-entropy go routines being started unnecessary retry loops.
This change changes the behavior to perform synchronous full syncs when
necessary removing the need for all of the time.Sleep and most of the
retry loops.
2017-10-23 10:56:04 +02:00
Frank Schroeder
6b966e48ce
local state: fix test with updated error message
2017-10-23 10:56:04 +02:00
Frank Schroeder
632c43e575
local state: fix failing tests
2017-10-23 10:56:03 +02:00
Frank Schroeder
ea92ee308a
local state: tests compile
2017-10-23 10:56:03 +02:00
Frank Schroeder
7289576988
local state: replace multi-map state with structs
...
The state of the service and health check records was spread out over
multiple maps guarded by a single lock. Access to the maps has to happen
in a coordinated effort and the tests often violated this which made
them brittle and racy.
This patch replaces the multiple maps with a single one for both checks
and services to make the code less fragile.
This is also necessary since moving the local state into its own package
creates circular dependencies for the tests. To avoid this the tests can
no longer access internal data structures which they should not be doing
in the first place.
The tests still don't compile but this is a ncessary step in that
direction.
2017-10-23 10:56:03 +02:00
Frank Schroeder
bc7571cccf
local state: move to separate package
...
This patch moves the local state to a separate package to further
decouple it from the agent code.
The code compiles but the tests do not yet.
2017-10-23 10:56:03 +02:00
Frank Schroeder
b363586813
agent: simplify some loops
2017-10-23 10:56:03 +02:00
Frank Schroeder
218cd4d501
agent: refactor sync loop to linear flow of control
2017-10-23 10:56:03 +02:00
Frank Schroeder
8cc4ee886d
agent: cleanup StateSyncer
...
This patch cleans up the state syncer code by renaming fields, adding
helpers and documentation.
2017-10-23 10:56:03 +02:00
Frank Schroeder
e7051da8d1
agent: decouple anti-entropy from local state
...
The anti-entropy code manages background synchronizations of the local
state on a regular basis or on demand when either the state has changed
or a new consul server has been added.
This patch moves the anti-entropy code into its own package and
decouples it from the local state code since they are performing
two different functions.
To simplify code-review this revision does not make any optimizations,
renames or refactorings. This will happen in subsequent commits.
2017-10-23 10:56:03 +02:00
Frank Schroeder
c2a3f5e007
Merge pull request #3585 from hashicorp/document-runtime-config
...
Moving the previous `agent/config.go` documentation to
`agent/config/runtime.go`.
2017-10-23 10:51:22 +02:00
Frank Schroeder
f3ecef290c
Merge pull request #3598 from hashicorp/issue-3397-error-with-extra-flags
...
The `consul agent` command was ignoring extra command line arguments
which can lead to confusion when the user has for example forgotten to
add a dash in front of an argument or is not using an `=` when setting
boolean flags to `true`. `-bootstrap true` is not the same as
`-bootstrap=true`, for example.
Since all command line flags are known and we don't expect unparsed
arguments we can return an error. However, this may make it slightly
more difficult in the future if we ever wanted to have these kinds of
arguments.
Fixes #3397
2017-10-23 10:47:04 +02:00
Frank Schroeder
6517d7720a
Merge pull request #3600 from hashicorp/support-go-sockaddr-for-dns-recursors
...
DNS recursors can be added through go-sockaddr templates. Entries
are deduplicated while the order is maintained.
Originally proposed by @taylorchu
See #2932
2017-10-23 10:45:36 +02:00
Frank Schroeder
0ec82b0445
Revert "config: add support for go-sockaddr templates for DNS recursors"
...
This reverts commit 72bee6284d44e0ed3e18e6819188f1d32528478c.
2017-10-23 10:08:35 +02:00
Frank Schroeder
39d1ceffb5
Revert "config: do not allow an ANY address as DNS recursor"
...
This reverts commit 1db8d3cb00bec980480d525571cea76c6c49c3e7.
2017-10-23 10:08:35 +02:00
Frank Schroeder
759350b61f
Revert "agent: decouple anti-entropy from local state"
...
This reverts commit a842dc9c2bf00855ef93211232da36b2d91eab5b.
2017-10-23 10:08:35 +02:00
Frank Schroeder
0d0233acd7
Revert "agent: cleanup StateSyncer"
...
This reverts commit b7136e100bef727144c202ae55f81152ac6a8b5f.
2017-10-23 10:08:35 +02:00
Frank Schroeder
113ba546e7
Revert "agent: refactor sync loop to linear flow of control"
...
This reverts commit 7a2af206ea964fc0846f9b80c10ea9d91cb3c99e.
2017-10-23 10:08:35 +02:00
Frank Schroeder
a96798f441
Revert "agent: simplify some loops"
...
This reverts commit b5dbad910c63b29dadf10731808d6891067a2bfa.
2017-10-23 10:08:34 +02:00
Frank Schroeder
443fe8e4db
Revert "local state: move to separate package"
...
This reverts commit d447e823c63720c74bb02459a985724f035f023e.
2017-10-23 10:08:34 +02:00
Frank Schroeder
435b442c8b
Revert "local state: replace multi-map state with structs"
...
This reverts commit ccbae7da5bceeb2328ab7993a8badbf2e72a4597.
2017-10-23 10:08:34 +02:00
Frank Schroeder
138aa25280
Revert "local state: tests compile"
...
This reverts commit 1af52bf7be02d952e16e14209899a9715451f7ba.
2017-10-23 10:08:34 +02:00
Frank Schroeder
571637cf7d
Revert "local state: fix failing tests"
...
This reverts commit 76682da4a048b623a1c201eb56710639437a9ed9.
2017-10-23 10:08:34 +02:00
Frank Schroeder
80d9df69e4
Revert "local state: fix test with updated error message"
...
This reverts commit e9149f64d9afb38246f9432edd806321c1eefb83.
2017-10-23 10:08:34 +02:00
Frank Schroeder
ded6f79b6a
Revert "local state: fix anti-entropy state tests"
...
This reverts commit f8e20cd9960e19bbe61e258c445250723870816f.
2017-10-23 10:08:34 +02:00
Frank Schroeder
9b40a3cde6
Revert "agent: skip non-sensical TestCatalogRegister"
...
This reverts commit ce1f35373e6ad1486cb83398fce70f5c54f910d3.
2017-10-23 10:08:34 +02:00
Frank Schroeder
5aa77fb9e4
Revert "local state: drop retry loops from tests"
...
This reverts commit 2bdba8ab06d1c9dd99d5e7cf8370c94b4f7adfaa.
2017-10-23 10:08:34 +02:00
Frank Schroeder
d7bb81a940
Revert "local state: rename tests"
...
This reverts commit ff62eaf0634a4c09377c53d4623685437f217b49.
2017-10-23 10:08:34 +02:00
Frank Schroeder
3d67ce9000
Revert "local state: fix TestAgentAntiEntropy_EnableTagOverride"
...
This reverts commit 86f7ea601342d6f3ceb9d0dc74bd5b33dae0b8d8.
2017-10-23 10:08:34 +02:00
Frank Schroeder
1bd73d2a6e
Revert "local state: refactor TestAgentAntiEntropy_EnableTagOverride"
...
This reverts commit c28e23eac8ada7a668b13e9a4a3d8066457488ef.
2017-10-23 10:08:33 +02:00
Frank Schroeder
c72d21813b
Revert "local state: address review comments"
...
This reverts commit 1d315075b15647db7fcd42986c9c5673cbb77a77.
2017-10-23 10:08:33 +02:00
Frank Schroeder
4177bad4f3
Revert "local state: update comments"
...
This reverts commit 42188164f885188e3bc8cff70ea5aeb47d633b83.
2017-10-23 10:08:33 +02:00
Frank Schroeder
d1e514cedc
Revert "local state: update documentation of updateSyncState"
...
This reverts commit e86521e637d742bce1e460b6b960037cef3578ed.
2017-10-23 10:08:33 +02:00
Frank Schroeder
133b23fb77
Revert "local state: move Metadata methods together"
...
This reverts commit 9bc8127728a62beb94b28849070b6ac35c181404.
2017-10-23 10:08:33 +02:00
Frank Schroeder
67135cc33e
Revert "local state: rename Add{Check,Service}State to Set{Check,Service}State"
...
This reverts commit 9280841a80d98b253a8f23967875e45e5e37e093.
2017-10-23 10:08:33 +02:00
Frank Schroeder
79405b7ce3
Revert "ae: ensure that syncs are blocked when paused"
...
This reverts commit ffb265dd939cefd7e865d624d0a4ba81f88e4505.
2017-10-23 10:08:33 +02:00
Frank Schroeder
cb28151210
Revert "ae: restore previous pause/resume behavior"
...
This reverts commit 126046be2366afde97fdf01d0dceece2977dd6d6.
2017-10-23 10:08:33 +02:00
Frank Schroeder
ec186ca7ba
Revert "ae: make stagger function pluggable for testing"
...
This reverts commit 066ad01c3804a39161c4d46147aa2eb86e48cd67.
2017-10-23 10:08:33 +02:00
Frank Schroeder
272b729ad9
Revert "ae: add test for ifNotPausedRun"
...
This reverts commit f5177ef332b8396aea368b7dea18a976e029a54f.
2017-10-23 10:08:33 +02:00
Frank Schroeder
54cebeda74
Revert "ae: add test for resume triggering SyncChanges"
...
This reverts commit cd0262744deab9294af17e4039ed2e2a27818cde.
2017-10-23 10:08:32 +02:00
Frank Schroeder
7a92839663
Revert "ae: fix typo in constructor name"
...
This reverts commit e88f49e2ccc79f77b5395de28d8fbdfc6eeb36f6.
2017-10-23 10:08:32 +02:00
Frank Schroeder
4bdf161d5c
Revert "ae: make control flow more explicit"
...
This reverts commit b9a8b53d5257d679c427422c324e6f124664db60.
2017-10-23 10:08:32 +02:00
Frank Schroeder
6eae18ac63
Revert "ae: add test that we run a full before a partial sync"
...
This reverts commit 8158cec82969a1262de793ee46e13f63cc2954e6.
2017-10-23 10:08:32 +02:00
Frank Schroeder
701ed61230
Revert "ae: refactor StateSyncer to state machine for better testing"
...
This reverts commit 8a45365f68147dd13c1232bc574bd54e4a12e478.
2017-10-23 10:08:32 +02:00
Frank Schroeder
27b8e55dc4
Revert "ae: add remaining test cases"
...
This reverts commit c32915bb4ff28b1670e88edaf0bbb9779dc6e2bc.
2017-10-23 10:08:32 +02:00
Frank Schroeder
c27a2f1c66
Revert "ae: do not trigger on Resume while holding the lock"
...
This reverts commit bd00814301bbf5db037e739e91a0b66ebb564821.
2017-10-23 10:08:32 +02:00
Frank Schroeder
655a24e383
Revert "local state: use synchronized access to internal maps"
...
This reverts commit 39a2d8d25e629823e183e384e8414171edcf4164.
2017-10-23 10:08:32 +02:00
Frank Schroeder
fe0f7c961d
Revert "local state: clone check to avoid side effect"
...
This reverts commit af1243c7251fe6291145bbe4f4dacd374779c425.
2017-10-23 10:08:32 +02:00
Frank Schroeder
a6e55af1e0
Revert "local state: make test more robust"
...
This reverts commit f9267380dbcdb2746393eee5067e5037dff2b184.
2017-10-23 10:08:32 +02:00
Frank Schroeder
64d9529d94
Revert "local state: remove stale comment"
...
This reverts commit 35f4acdddc38f0371543e12b0d2ccb27a0a64869.
2017-10-23 10:08:32 +02:00
Frank Schroeder
aaf6e376e2
Revert "config: document telemetry options"
...
This reverts commit 7fede4472d4db87b4652253510556906821ac756.
2017-10-23 10:08:31 +02:00
Frank Schroeder
dcb70f7def
Revert "config: document http options"
...
This reverts commit 5f598574483e59af377ae447857d40872563ac87.
2017-10-23 10:08:31 +02:00
Frank Schroeder
1ce9c1ba45
Revert "config: document dns options"
...
This reverts commit 5e57e9273ea6e27eb79ed531189fd3c69e19c7b2.
2017-10-23 10:08:31 +02:00
Frank Schroeder
3638b2932d
Revert "config: document autopilot options"
...
This reverts commit 7685ef409c9340227e3969a86e0bfa627eafdd0f.
2017-10-23 10:08:31 +02:00
Frank Schroeder
32c8d7e0db
Revert "config: document acl options"
...
This reverts commit 7396bd31fd1c35347d0c88284ea358bfbd9ca948.
2017-10-23 10:08:31 +02:00
Frank Schroeder
83bfe0d223
Revert "config: document config options"
...
This reverts commit a38c69d7844a4e4a9d54051470977c7446fc8e57.
2017-10-23 10:08:31 +02:00
Frank Schroeder
ff42a00ef1
Revert "config: document more acl options"
...
This reverts commit 2682ce0b825528f379487cbd11c2c2a321fd94e8.
2017-10-23 10:08:31 +02:00
Frank Schroeder
6ae5c0594a
Revert "config: document more config options"
...
This reverts commit bf81cdea6eb90ae099201c545910780ccd020540.
2017-10-23 10:08:31 +02:00
Frank Schroeder
2d96f700c0
Revert "config: document more config options"
...
This reverts commit 9864609201f333cd90af9535e2e4d4c7c1e65c4a.
2017-10-23 10:08:31 +02:00
Frank Schroeder
bd72f3676d
Revert "config: document remaining config options"
...
This reverts commit 0ed4561f12cf52a44ab1f1887d4f4bfd27df77f4.
2017-10-23 10:08:31 +02:00
Frank Schroeder
64ac9f4f42
Revert "config: address review comments"
...
This reverts commit f6e9ad99ec6d230c1eb7f655d2a83e5a4e33807d.
2017-10-23 10:08:31 +02:00
Frank Schroeder
c5c586c7f1
Revert "fix go vet issue"
...
This reverts commit 078e50b635846920a17a3b06c678b2b63b40677a.
2017-10-23 10:00:26 +02:00
Frank Schröder
b580f7a533
Revert "config: rename test struct field to args"
...
This reverts commit f2a291a4704c9954c441567860ca740ac0f58308.
2017-10-23 09:58:37 +02:00
Frank Schröder
0f0b510f37
Revert "config: return error on extra command line arguments ( #3397 )"
...
This reverts commit ce935cef55f7298e85843b3ca17ad13415e40e0b.
2017-10-23 09:58:37 +02:00
Frank Schroeder
ef3108abc3
fix go vet issue
2017-10-23 08:13:52 +02:00
Frank Schroeder
24689c4f5e
config: return error on extra command line arguments ( #3397 )
...
The `consul agent` command was ignoring extra command line arguments
which can lead to confusion when the user has for example forgotten to
add a dash in front of an argument or is not using an `=` when setting
boolean flags to `true`. `-bootstrap true` is not the same as
`-bootstrap=true`, for example.
Since all command line flags are known and we don't expect unparsed
arguments we can return an error. However, this may make it slightly
more difficult in the future if we ever wanted to have these kinds of
arguments.
Fixes #3397
2017-10-23 08:08:09 +02:00
Frank Schroeder
c8ed3044de
config: rename test struct field to args
2017-10-23 08:08:09 +02:00
Frank Schroeder
c624c72d5c
config: return error on extra command line arguments ( #3397 )
...
The `consul agent` command was ignoring extra command line arguments
which can lead to confusion when the user has for example forgotten to
add a dash in front of an argument or is not using an `=` when setting
boolean flags to `true`. `-bootstrap true` is not the same as
`-bootstrap=true`, for example.
Since all command line flags are known and we don't expect unparsed
arguments we can return an error. However, this may make it slightly
more difficult in the future if we ever wanted to have these kinds of
arguments.
Fixes #3397
2017-10-23 08:07:48 +02:00
Frank Schroeder
c1d249c681
config: rename test struct field to args
2017-10-23 08:07:48 +02:00
Frank Schroeder
88a1f3aa53
config: address review comments
2017-10-23 08:06:26 +02:00
Frank Schroeder
97277de196
config: document remaining config options
2017-10-23 08:06:26 +02:00
Frank Schroeder
638bc0e0ac
config: document more config options
2017-10-23 08:06:26 +02:00
Frank Schroeder
f326eae23e
config: document more config options
2017-10-23 08:06:26 +02:00
Frank Schroeder
6332f4d6a7
config: document more acl options
2017-10-23 08:06:26 +02:00
Frank Schroeder
61c8ee564a
config: document config options
2017-10-23 08:06:26 +02:00
Frank Schroeder
71112a6510
config: document acl options
2017-10-23 08:06:26 +02:00
Frank Schroeder
e00869647c
config: document autopilot options
2017-10-23 08:06:26 +02:00
Frank Schroeder
05c1038d58
config: document dns options
2017-10-23 08:06:26 +02:00
Frank Schroeder
a17d711b39
config: document http options
2017-10-23 08:06:26 +02:00
Frank Schroeder
f95b8f5060
config: document telemetry options
2017-10-23 08:06:26 +02:00
Frank Schroeder
44cc334fc4
config: address review comments
2017-10-23 08:05:47 +02:00
Frank Schroeder
28083cb330
config: document remaining config options
2017-10-23 08:04:03 +02:00
Frank Schroeder
b2c2386d75
config: document more config options
2017-10-23 08:04:03 +02:00