open-consul/agent/consul
R.B. Boyer 813d69622e
agent: handle re-bootstrapping in a secondary datacenter when WAN federation via mesh gateways is configured (#7931)
The main fix here is to always union the `primary-gateways` list with
the list of mesh gateways in the primary returned from the replicated
federation states list. This will allow any replicated (incorrect) state
to be supplemented with user-configured (correct) state in the config
file. Eventually the game of random selection whack-a-mole will pick a
winning entry and re-replicate the latest federation states from the
primary. If the user-configured state is actually the incorrect one,
then the same eventual correct selection process will work in that case,
too.

The secondary fix is actually to finish making wanfed-via-mgws actually
work as originally designed. Once a secondary datacenter has replicated
federation states for the primary AND managed to stand up its own local
mesh gateways then all of the RPCs from a secondary to the primary
SHOULD go through two sets of mesh gateways to arrive in the consul
servers in the primary (one hop for the secondary datacenter's mesh
gateway, and one hop through the primary datacenter's mesh gateway).
This was neglected in the initial implementation. While everything
works, ideally we should treat communications that go around the mesh
gateways as just provided for bootstrapping purposes.

Now we heuristically use the success/failure history of the federation
state replicator goroutine loop to determine if our current mesh gateway
route is working as intended. If it is, we try using the local gateways,
and if those don't work we fall back on trying the primary via the union
of the replicated state and the go-discover configuration flags.

This can be improved slightly in the future by possibly initializing the
gateway choice to local on startup if we already have replicated state.
This PR does not address that improvement.

Fixes #7339
2020-05-27 11:31:10 -05:00
..
authmethod Add unconvert linter 2020-05-12 13:47:25 -04:00
autopilot Remove unused var 2020-05-19 16:50:14 -04:00
discoverychain Construct a default destination if one does not exist for service-router (#7783) 2020-05-05 10:49:50 -05:00
fsm Restoring config entries updates the gateway-services table (#7811) 2020-05-08 13:24:33 -05:00
prepared_query Fix a number of problems found by staticcheck 2020-05-19 16:50:14 -04:00
state Update agent/consul/state/catalog.go 2020-05-20 16:34:14 -04:00
testdata
wanfed wan federation via mesh gateways (#6884) 2020-03-09 15:59:02 -05:00
acl.go Fix identity resolution on clients and in secondary dcs (#7862) 2020-05-13 13:00:08 -04:00
acl_authmethod.go acl: add auth method for JWTs (#7846) 2020-05-11 20:59:29 -05:00
acl_authmethod_oss.go acl: add auth method for JWTs (#7846) 2020-05-11 20:59:29 -05:00
acl_authmethod_test.go acl: refactor the authmethod.Validator interface (#7760) 2020-05-01 17:35:28 -05:00
acl_client.go Fix identity resolution on clients and in secondary dcs (#7862) 2020-05-13 13:00:08 -04:00
acl_endpoint.go acl: add auth method for JWTs (#7846) 2020-05-11 20:59:29 -05:00
acl_endpoint_legacy.go Some boilerplate to allow for ACL Bootstrap disabling configurability 2020-04-28 09:42:46 -04:00
acl_endpoint_oss.go acl: add auth method for JWTs (#7846) 2020-05-11 20:59:29 -05:00
acl_endpoint_test.go acl: add auth method for JWTs (#7846) 2020-05-11 20:59:29 -05:00
acl_oss.go Allow the PolicyResolve and RoleResolve endpoints to process na… (#7296) 2020-02-13 14:55:27 -05:00
acl_oss_test.go
acl_replication.go Allow users to configure either unstructured or JSON logging (#7130) 2020-01-28 17:50:41 -06:00
acl_replication_legacy.go Allow users to configure either unstructured or JSON logging (#7130) 2020-01-28 17:50:41 -06:00
acl_replication_legacy_test.go AuthMethod updates to support alternate namespace logins (#7029) 2020-01-14 10:09:29 -05:00
acl_replication_test.go AuthMethod updates to support alternate namespace logins (#7029) 2020-01-14 10:09:29 -05:00
acl_replication_types.go AuthMethod updates to support alternate namespace logins (#7029) 2020-01-14 10:09:29 -05:00
acl_server.go Fix identity resolution on clients and in secondary dcs (#7862) 2020-05-13 13:00:08 -04:00
acl_server_oss.go Allow the bootstrap endpoint to be disabled in enterprise. (#7614) 2020-04-14 11:45:39 -04:00
acl_test.go Fix identity resolution on clients and in secondary dcs (#7862) 2020-05-13 13:00:08 -04:00
acl_token_exp.go Allow users to configure either unstructured or JSON logging (#7130) 2020-01-28 17:50:41 -06:00
acl_token_exp_test.go
auto_encrypt.go Add unconvert linter 2020-05-12 13:47:25 -04:00
auto_encrypt_endpoint.go auto_encrypt: check previously ignored error (#6604) 2020-02-03 10:35:11 +01:00
auto_encrypt_endpoint_test.go auto_encrypt: set dns and ip san for k8s and provide configuration (#6944) 2020-01-17 23:25:26 +01:00
auto_encrypt_test.go Allow users to configure either unstructured or JSON logging (#7130) 2020-01-28 17:50:41 -06:00
autopilot.go
autopilot_oss.go
autopilot_test.go Fix flaky TestAutopilot_BootstrapExpect (#7242) 2020-02-10 14:52:58 -06:00
catalog_endpoint.go Updates to Config Entries and Connect for Namespaces (#7116) 2020-01-24 10:04:58 -05:00
catalog_endpoint_test.go Terminating gateway discovery (#7571) 2020-04-08 12:37:24 -06:00
client.go rpc: oss changes for network area connection pooling (#7735) 2020-04-30 22:12:17 +02:00
client_serf.go agent: differentiate wan vs lan loggers in memberlist and serf (#7205) 2020-02-05 09:52:43 -06:00
client_test.go Allow to restrict servers that can join a given Serf Consul cluster. (#7628) 2020-05-20 11:31:19 +02:00
cluster_test.go A couple testing helper updates (#7694) 2020-04-27 12:17:38 -04:00
config.go agent: stub out auditing functionality in OSS 2020-04-16 15:07:52 -07:00
config_endpoint.go connect: ensure proxy-defaults protocol is used for upstreams (#7938) 2020-05-21 16:08:39 -05:00
config_endpoint_test.go connect: ensure proxy-defaults protocol is used for upstreams (#7938) 2020-05-21 16:08:39 -05:00
config_replication.go various tweaks on top of the hclog work (#7165) 2020-01-29 11:16:08 -06:00
config_replication_test.go Updates to Config Entries and Connect for Namespaces (#7116) 2020-01-24 10:04:58 -05:00
connect_ca_endpoint.go Catalog + Namespace OSS changes. (#7219) 2020-02-10 10:40:44 -05:00
connect_ca_endpoint_test.go
consul_ca_delegate.go
coordinate_endpoint.go Catalog + Namespace OSS changes. (#7219) 2020-02-10 10:40:44 -05:00
coordinate_endpoint_test.go
discovery_chain_endpoint.go Updates to Config Entries and Connect for Namespaces (#7116) 2020-01-24 10:04:58 -05:00
discovery_chain_endpoint_test.go
enterprise_client_oss.go Sync some feature flag support from enterprise (#7167) 2020-01-29 13:21:38 -05:00
enterprise_config_oss.go
enterprise_server_oss.go Fix ACL mode advertisement and detection (#7451) 2020-03-16 12:54:45 -04:00
federation_state_endpoint.go wan federation via mesh gateways (#6884) 2020-03-09 15:59:02 -05:00
federation_state_endpoint_test.go wan federation via mesh gateways (#6884) 2020-03-09 15:59:02 -05:00
federation_state_replication.go agent: handle re-bootstrapping in a secondary datacenter when WAN federation via mesh gateways is configured (#7931) 2020-05-27 11:31:10 -05:00
federation_state_replication_test.go fix flaky TestReplication_FederationStates test due to race conditions (#7612) 2020-04-09 15:42:41 -05:00
filter.go Updates to the Txn API for namespaces (#7172) 2020-01-30 13:12:26 -05:00
filter_test.go
flood.go agent: refactor to use a single addrFn 2020-05-05 21:08:10 +02:00
gateway_locator.go agent: handle re-bootstrapping in a secondary datacenter when WAN federation via mesh gateways is configured (#7931) 2020-05-27 11:31:10 -05:00
gateway_locator_test.go agent: handle re-bootstrapping in a secondary datacenter when WAN federation via mesh gateways is configured (#7931) 2020-05-27 11:31:10 -05:00
health_endpoint.go Ingress Gateways for TCP services (#7509) 2020-04-16 14:00:48 -07:00
health_endpoint_test.go Require individual services in ingress entry to match protocols (#7774) 2020-05-06 16:09:24 -05:00
helper_test.go A couple testing helper updates (#7694) 2020-04-27 12:17:38 -04:00
intention_endpoint.go Enable filtering language support for the v1/connect/intentions… (#7593) 2020-04-07 11:48:44 -04:00
intention_endpoint_test.go Enable filtering language support for the v1/connect/intentions… (#7593) 2020-04-07 11:48:44 -04:00
internal_endpoint.go Do not return an error if requested service is not a gateway 2020-05-18 09:08:04 -05:00
internal_endpoint_test.go Do not return an error if requested service is not a gateway 2020-05-18 09:08:04 -05:00
issue_test.go Allow users to configure either unstructured or JSON logging (#7130) 2020-01-28 17:50:41 -06:00
kvs_endpoint.go Allow users to configure either unstructured or JSON logging (#7130) 2020-01-28 17:50:41 -06:00
kvs_endpoint_test.go
leader.go Update the Client code to use the common version checking infra… (#7558) 2020-04-14 11:54:27 -04:00
leader_connect.go Ensure server requirements checks are done against ALL known se… (#7491) 2020-03-27 12:31:43 -04:00
leader_connect_test.go connect: add validations around intermediate cert ttl (#7213) 2020-02-11 00:05:49 +01:00
leader_federation_state_ae.go wan federation via mesh gateways (#6884) 2020-03-09 15:59:02 -05:00
leader_federation_state_ae_test.go wan federation via mesh gateways (#6884) 2020-03-09 15:59:02 -05:00
leader_routine_manager.go Fix a number of problems found by staticcheck 2020-05-19 16:50:14 -04:00
leader_routine_manager_test.go Allow users to configure either unstructured or JSON logging (#7130) 2020-01-28 17:50:41 -06:00
leader_test.go Update the Client code to use the common version checking infra… (#7558) 2020-04-14 11:54:27 -04:00
logging.go Allow users to configure either unstructured or JSON logging (#7130) 2020-01-28 17:50:41 -06:00
logging_test.go Allow users to configure either unstructured or JSON logging (#7130) 2020-01-28 17:50:41 -06:00
merge.go agent: don't let left nodes hold onto their node-id (#7747) 2020-05-04 18:39:08 +02:00
merge_test.go
operator_autopilot_endpoint.go Add managed service provider token (#7218) 2020-02-04 13:58:56 -07:00
operator_autopilot_endpoint_test.go
operator_endpoint.go Allow users to configure either unstructured or JSON logging (#7130) 2020-01-28 17:50:41 -06:00
operator_raft_endpoint.go Add managed service provider token (#7218) 2020-02-04 13:58:56 -07:00
operator_raft_endpoint_test.go
prepared_query_endpoint.go wan federation via mesh gateways (#6884) 2020-03-09 15:59:02 -05:00
prepared_query_endpoint_test.go Allow users to configure either unstructured or JSON logging (#7130) 2020-01-28 17:50:41 -06:00
raft_rpc.go
replication.go Allow users to configure either unstructured or JSON logging (#7130) 2020-01-28 17:50:41 -06:00
replication_test.go Allow users to configure either unstructured or JSON logging (#7130) 2020-01-28 17:50:41 -06:00
rpc.go rpc: oss changes for network area connection pooling (#7735) 2020-04-30 22:12:17 +02:00
rpc_test.go server: strip local ACL tokens from RPCs during forwarding if crossing datacenters (#7419) 2020-03-10 11:15:22 -05:00
rtt.go
rtt_test.go
segment_oss.go Fix spelling of deregister (#7804) 2020-05-08 10:03:45 -04:00
serf_test.go
server.go agent: handle re-bootstrapping in a secondary datacenter when WAN federation via mesh gateways is configured (#7931) 2020-05-27 11:31:10 -05:00
server_lookup.go Fix ACL mode advertisement and detection (#7451) 2020-03-16 12:54:45 -04:00
server_lookup_test.go
server_oss.go wan federation via mesh gateways (#6884) 2020-03-09 15:59:02 -05:00
server_serf.go Add unconvert linter 2020-05-12 13:47:25 -04:00
server_test.go Allow to restrict servers that can join a given Serf Consul cluster. (#7628) 2020-05-20 11:31:19 +02:00
session_endpoint.go Fix session backwards incompatibility with 1.6.x and earlier. 2020-03-05 15:34:55 -05:00
session_endpoint_test.go Fix session backwards incompatibility with 1.6.x and earlier. 2020-03-05 15:34:55 -05:00
session_timers.go
session_timers_test.go
session_ttl.go agent: add server raft.{last,applied}_index gauges (#6694) 2020-02-11 10:50:18 +01:00
session_ttl_test.go
snapshot_endpoint.go wan federation via mesh gateways (#6884) 2020-03-09 15:59:02 -05:00
snapshot_endpoint_test.go wan federation via mesh gateways (#6884) 2020-03-09 15:59:02 -05:00
stats_fetcher.go rpc: oss changes for network area connection pooling (#7735) 2020-04-30 22:12:17 +02:00
stats_fetcher_test.go
status_endpoint.go
status_endpoint_test.go wan federation via mesh gateways (#6884) 2020-03-09 15:59:02 -05:00
txn_endpoint.go Updates to the Txn API for namespaces (#7172) 2020-01-30 13:12:26 -05:00
txn_endpoint_test.go
util.go acl: refactor the authmethod.Validator interface (#7760) 2020-05-01 17:35:28 -05:00
util_test.go acl: refactor the authmethod.Validator interface (#7760) 2020-05-01 17:35:28 -05:00