open-consul/agent
R.B. Boyer 0b79707beb
grpc: ensure grpc resolver correctly uses lan/wan addresses on servers (#17270)
The grpc resolver implementation is fed from changes to the
router.Router. Within the router there is a map of various areas storing
the addressing information for servers in those areas. All map entries
are of the WAN variety except a single special entry for the LAN.

Addressing information in the LAN "area" are local addresses intended
for use when making a client-to-server or server-to-server request.

The client agent correctly updates this LAN area when receiving lan serf
events, so by extension the grpc resolver works fine in that scenario.

The server agent only initially populates a single entry in the LAN area
(for itself) on startup, and then never mutates that area map again.
For normal RPCs a different structure is used for LAN routing.

Additionally when selecting a server to contact in the local datacenter
it will randomly select addresses from either the LAN or WAN addressed
entries in the map.

Unfortunately this means that the grpc resolver stack as it exists on
server agents is either broken or only accidentally functions by having
servers dial each other over the WAN-accessible address. If the operator
disables the serf wan port completely likely this incidental functioning
would break.

This PR enforces that local requests for servers (both for stale reads
or leader forwarded requests) exclusively use the LAN "area" information
and also fixes it so that servers keep that area up to date in the
router.

A test for the grpc resolver logic was added, as well as a higher level
full-stack test to ensure the externally perceived bug does not return.
2023-05-11 11:08:57 -05:00
..
ae copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
auto-config copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
cache Revert "cache: refactor agent cache fetching to prevent unnecessary f… (#16818) (#17046) 2023-04-19 13:17:21 -05:00
cache-types add order by locality failover to Consul enterprise (#16791) 2023-03-30 10:08:38 -04:00
checks ci: remove test-integrations CircleCI workflow (#16928) 2023-04-19 16:19:29 +00:00
config Update HCP bootstrapping to support existing clusters (#16916) 2023-04-27 22:27:39 +02:00
configentry peering: ensure that merged central configs of peered upstreams for partitioned downstreams work (#17179) 2023-04-28 12:36:08 -05:00
connect enable auto-tidy expired issuers in vault (as CA) 2023-05-03 20:30:37 +00:00
consul grpc: ensure grpc resolver correctly uses lan/wan addresses on servers (#17270) 2023-05-11 11:08:57 -05:00
debug copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
dns copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
envoyextensions Wasm Envoy HTTP extension (#16877) 2023-04-06 14:12:07 -07:00
exec copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
grpc-external resource: add missing validation to the `List` and `WatchList` endpoints (#17213) 2023-05-10 10:38:48 +01:00
grpc-internal grpc: ensure grpc resolver correctly uses lan/wan addresses on servers (#17270) 2023-05-11 11:08:57 -05:00
grpc-middleware resource: List resources by owner (#17190) 2023-05-08 12:26:19 -05:00
hcp Update HCP bootstrapping to support existing clusters (#16916) 2023-04-27 22:27:39 +02:00
local copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
log-drop copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
metadata copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
metrics copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
mock copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
pool Raft storage backend (#16619) 2023-04-04 17:30:06 +01:00
proxycfg Hash namespace+proxy ID when creating socket path (#17204) 2023-05-09 12:20:26 -06:00
proxycfg-glue Use auth context when evaluating service read permissions (#17207) 2023-05-02 16:23:42 -04:00
proxycfg-sources copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
router copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
routine-leak-checker copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
rpc grpc: ensure grpc resolver correctly uses lan/wan addresses on servers (#17270) 2023-05-11 11:08:57 -05:00
rpcclient [COMPLIANCE] Add Copyright and License Headers (#16854) 2023-04-20 12:40:22 +00:00
structs Hash namespace+proxy ID when creating socket path (#17204) 2023-05-09 12:20:26 -06:00
submatview * added Sameness Group to proto files (#16998) 2023-04-14 09:24:46 -07:00
systemd copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
token copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
uiserver copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
xds Hash namespace+proxy ID when creating socket path (#17204) 2023-05-09 12:20:26 -06:00
acl.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
acl_endpoint.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
acl_endpoint_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
acl_oss.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
acl_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
agent.go Update HCP bootstrapping to support existing clusters (#16916) 2023-04-27 22:27:39 +02:00
agent_endpoint.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
agent_endpoint_oss.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
agent_endpoint_oss_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
agent_endpoint_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
agent_oss.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
agent_oss_test.go feat: add reporting config with reload (#16890) 2023-04-11 15:04:02 -04:00
agent_test.go Revert "cache: refactor agent cache fetching to prevent unnecessary f… (#16818) (#17046) 2023-04-19 13:17:21 -05:00
apiserver.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
apiserver_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
catalog_endpoint.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
catalog_endpoint_oss.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
catalog_endpoint_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
check.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
config_endpoint.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
config_endpoint_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
connect_auth.go Add sameness groups to service intentions. (#17064) 2023-04-20 12:16:04 -04:00
connect_ca_endpoint.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
connect_ca_endpoint_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
coordinate_endpoint.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
coordinate_endpoint_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
delegate_mock_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
denylist.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
denylist_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
discovery_chain_endpoint.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
discovery_chain_endpoint_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
dns.go * added Sameness Group to proto files (#16998) 2023-04-14 09:24:46 -07:00
dns_oss.go * added Sameness Group to proto files (#16998) 2023-04-14 09:24:46 -07:00
dns_oss_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
dns_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
enterprise_delegate_oss.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
event_endpoint.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
event_endpoint_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
federation_state_endpoint.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
health_endpoint.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
health_endpoint_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
http.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
http_decode_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
http_oss.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
http_oss_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
http_register.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
http_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
intentions_endpoint.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
intentions_endpoint_oss_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
intentions_endpoint_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
keyring.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
keyring_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
kvs_endpoint.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
kvs_endpoint_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
metrics.go log warning about certificate expiring sooner and with more details 2023-04-07 20:38:07 +00:00
metrics_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
nodeid.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
nodeid_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
notify.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
notify_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
operator_endpoint.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
operator_endpoint_oss.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
operator_endpoint_oss_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
operator_endpoint_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
peering_endpoint.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
peering_endpoint_oss_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
peering_endpoint_test.go grpc: ensure grpc resolver correctly uses lan/wan addresses on servers (#17270) 2023-05-11 11:08:57 -05:00
prepared_query_endpoint.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
prepared_query_endpoint_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
proxycfg_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
reload.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
remote_exec.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
remote_exec_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
retry_join.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
retry_join_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
service_checks_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
service_manager.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
service_manager_test.go Remove deprecated service-defaults upstream behavior. (#16957) 2023-04-11 10:20:33 -05:00
session_endpoint.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
session_endpoint_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
setup.go grpc: ensure grpc resolver correctly uses lan/wan addresses on servers (#17270) 2023-05-11 11:08:57 -05:00
setup_oss.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
sidecar_service.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
sidecar_service_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
signal_unix.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
signal_windows.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
snapshot_endpoint.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
snapshot_endpoint_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
status_endpoint.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
status_endpoint_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
streaming_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
testagent.go Revert "cache: refactor agent cache fetching to prevent unnecessary f… (#16818) (#17046) 2023-04-19 13:17:21 -05:00
testagent_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
translate_addr.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
txn_endpoint.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
txn_endpoint_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
ui_endpoint.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
ui_endpoint_oss_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
ui_endpoint_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
user_event.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
user_event_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
util.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
util_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
watch_handler.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
watch_handler_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00