open-consul/agent/cache-types
R.B. Boyer 64fc002e03
connect: fix failover through a mesh gateway to a remote datacenter (#6259)
Failover is pushed entirely down to the data plane by creating envoy
clusters and putting each successive destination in a different load
assignment priority band. For example this shows that normally requests
go to 1.2.3.4:8080 but when that fails they go to 6.7.8.9:8080:

- name: foo
  load_assignment:
    cluster_name: foo
    policy:
      overprovisioning_factor: 100000
    endpoints:
    - priority: 0
      lb_endpoints:
      - endpoint:
          address:
            socket_address:
              address: 1.2.3.4
              port_value: 8080
    - priority: 1
      lb_endpoints:
      - endpoint:
          address:
            socket_address:
              address: 6.7.8.9
              port_value: 8080

Mesh gateways route requests based solely on the SNI header tacked onto
the TLS layer. Envoy currently only lets you configure the outbound SNI
header at the cluster layer.

If you try to failover through a mesh gateway you ideally would
configure the SNI value per endpoint, but that's not possible in envoy
today.

This PR introduces a simpler way around the problem for now:

1. We identify any target of failover that will use mesh gateway mode local or
   remote and then further isolate any resolver node in the compiled discovery
   chain that has a failover destination set to one of those targets.

2. For each of these resolvers we will perform a small measurement of
   comparative healths of the endpoints that come back from the health API for the
   set of primary target and serial failover targets. We walk the list of targets
   in order and if any endpoint is healthy we return that target, otherwise we
   move on to the next target.

3. The CDS and EDS endpoints both perform the measurements in (2) for the
   affected resolver nodes.

4. For CDS this measurement selects which TLS SNI field to use for the cluster
   (note the cluster is always going to be named for the primary target)

5. For EDS this measurement selects which set of endpoints will populate the
   cluster. Priority tiered failover is ignored.

One of the big downsides to this approach to failover is that the failover
detection and correction is going to be controlled by consul rather than
deferring that entirely to the data plane as with the prior version. This also
means that we are bound to only failover using official health signals and
cannot make use of data plane signals like outlier detection to affect
failover.

In this specific scenario the lack of data plane signals is ok because the
effectiveness is already muted by the fact that the ultimate destination
endpoints will have their data plane signals scrambled when they pass through
the mesh gateway wrapper anyway so we're not losing much.

Another related fix is that we now use the endpoint health from the
underlying service, not the health of the gateway (regardless of
failover mode).
2019-08-05 13:30:35 -05:00
..
catalog_datacenters.go New Cache Types (#5995) 2019-06-24 14:11:34 -04:00
catalog_datacenters_test.go New Cache Types (#5995) 2019-06-24 14:11:34 -04:00
catalog_list_services.go New Cache Types (#5995) 2019-06-24 14:11:34 -04:00
catalog_list_services_test.go New Cache Types (#5995) 2019-06-24 14:11:34 -04:00
catalog_services.go merge feedback: fix typos; actually use deliverLatest added previously but not plumbed in 2018-10-10 16:55:34 +01:00
catalog_services_test.go bugfix: use ServiceTags to generate cache key hash (#4987) 2019-01-07 21:30:47 +00:00
config_entry.go Implement caching for config entry lists 2019-07-02 10:11:19 -04:00
config_entry_test.go Implement caching for config entry lists 2019-07-02 10:11:19 -04:00
connect_ca_leaf.go Revert "connect: support AWS PCA as a CA provider" (#6251) 2019-07-31 09:08:10 -04:00
connect_ca_leaf_test.go tls: auto_encrypt enables automatic RPC cert provisioning for consul clients (#5597) 2019-06-27 22:22:07 +02:00
connect_ca_root.go Support Agent Caching for Service Discovery Results (#4541) 2018-10-10 16:55:34 +01:00
connect_ca_root_test.go agent/cache-types: rename to separate root and leaf cache types 2018-06-14 09:42:01 -07:00
discovery_chain.go connect: expose an API endpoint to compile the discovery chain (#6248) 2019-08-02 15:34:54 -05:00
discovery_chain_test.go connect: fix failover through a mesh gateway to a remote datacenter (#6259) 2019-08-05 13:30:35 -05:00
health_services.go Support Agent Caching for Service Discovery Results (#4541) 2018-10-10 16:55:34 +01:00
health_services_test.go bugfix: use ServiceTags to generate cache key hash (#4987) 2019-01-07 21:30:47 +00:00
intention_match.go Support Agent Caching for Service Discovery Results (#4541) 2018-10-10 16:55:34 +01:00
intention_match_test.go agent/cache: address PR feedback, lots of typos 2018-06-14 09:42:03 -07:00
mock_RPC.go agent/cache: Reorganize some files, RequestInfo struct, prepare for partitioning 2018-06-14 09:42:00 -07:00
node_services.go Allow DNS interface to use agent cache (#5300) 2019-02-25 14:06:01 -05:00
node_services_test.go Allow DNS interface to use agent cache (#5300) 2019-02-25 14:06:01 -05:00
prepared_query.go Support Agent Caching for Service Discovery Results (#4541) 2018-10-10 16:55:34 +01:00
prepared_query_test.go Support Agent Caching for Service Discovery Results (#4541) 2018-10-10 16:55:34 +01:00
resolved_service_config.go Make central service config opt-in and rework the initial registration 2019-04-24 06:11:08 -07:00
resolved_service_config_test.go Add integration test for central config; fix central config WIP (#5752) 2019-05-01 16:39:31 -07:00
rpc.go agent/cache: Reorganize some files, RequestInfo struct, prepare for partitioning 2018-06-14 09:42:00 -07:00
service_dump.go Implement Kind based ServiceDump and caching of the ServiceDump RPC 2019-07-01 16:28:30 -04:00
service_dump_test.go Implement Kind based ServiceDump and caching of the ServiceDump RPC 2019-07-01 16:28:30 -04:00
testing.go agent/cache-types: got basic CA leaf caching work, major problems still 2018-06-14 09:42:01 -07:00