consul/agent/proxycfg
R.B. Boyer 72f991d8d3
agent: remove agent cache dependency from service mesh leaf certificate management (#17075)
* agent: remove agent cache dependency from service mesh leaf certificate management

This extracts the leaf cert management from within the agent cache.

This code was produced by the following process:

1. All tests in agent/cache, agent/cache-types, agent/auto-config,
   agent/consul/servercert were run at each stage.

    - The tests in agent matching .*Leaf were run at each stage.

    - The tests in agent/leafcert were run at each stage after they
      existed.

2. The former leaf cert Fetch implementation was extracted into a new
   package behind a "fake RPC" endpoint to make it look almost like all
   other cache type internals.

3. The old cache type was shimmed to use the fake RPC endpoint and
   generally cleaned up.

4. I selectively duplicated all of Get/Notify/NotifyCallback/Prepopulate
   from the agent/cache.Cache implementation over into the new package.
   This was renamed as leafcert.Manager.

    - Code that was irrelevant to the leaf cert type was deleted
      (inlining blocking=true, refresh=false)

5. Everything that used the leaf cert cache type (including proxycfg
   stuff) was shifted to use the leafcert.Manager instead.

6. agent/cache-types tests were moved and gently replumbed to execute
   as-is against a leafcert.Manager.

7. Inspired by some of the locking changes from derek's branch I split
   the fat lock into N+1 locks.

8. The waiter chan struct{} was eventually replaced with a
   singleflight.Group around cache updates, which was likely the biggest
   net structural change.

9. The awkward two layers or logic produced as a byproduct of marrying
   the agent cache management code with the leaf cert type code was
   slowly coalesced and flattened to remove confusion.

10. The .*Leaf tests from the agent package were copied and made to work
    directly against a leafcert.Manager to increase direct coverage.

I have done a best effort attempt to port the previous leaf-cert cache
type's tests over in spirit, as well as to take the e2e-ish tests in the
agent package with Leaf in the test name and copy those into the
agent/leafcert package to get more direct coverage, rather than coverage
tangled up in the agent logic.

There is no net-new test coverage, just coverage that was pushed around
from elsewhere.
2023-06-13 10:54:45 -05:00
..
internal/watch copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
api_gateway.go agent: remove agent cache dependency from service mesh leaf certificate management (#17075) 2023-06-13 10:54:45 -05:00
connect_proxy.go agent: remove agent cache dependency from service mesh leaf certificate management (#17075) 2023-06-13 10:54:45 -05:00
data_sources.go agent: remove agent cache dependency from service mesh leaf certificate management (#17075) 2023-06-13 10:54:45 -05:00
data_sources_oss.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
deep-copy.sh copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
ingress_gateway.go agent: remove agent cache dependency from service mesh leaf certificate management (#17075) 2023-06-13 10:54:45 -05:00
manager.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
manager_test.go agent: remove agent cache dependency from service mesh leaf certificate management (#17075) 2023-06-13 10:54:45 -05:00
mesh_gateway.go agent: remove agent cache dependency from service mesh leaf certificate management (#17075) 2023-06-13 10:54:45 -05:00
mesh_gateway_oss.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
naming.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
naming_oss.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
naming_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
proxycfg.deepcopy.go xds: Remove APIGateway ToIngress function (#17453) 2023-05-25 15:16:37 +00:00
proxycfg.go docs: add envoy to the proxycfg diagram (#16834) 2023-04-04 09:42:42 -04:00
snapshot.go [API Gateway] Fix trust domain for external peered services in synthesis code (#17609) 2023-06-08 12:18:17 -04:00
snapshot_test.go xds: Remove APIGateway ToIngress function (#17453) 2023-05-25 15:16:37 +00:00
state.go JWT Authentication with service intentions: xds package update (#17414) 2023-05-19 18:14:16 -04:00
state_oss_test.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
state_test.go agent: remove agent cache dependency from service mesh leaf certificate management (#17075) 2023-06-13 10:54:45 -05:00
terminating_gateway.go agent: remove agent cache dependency from service mesh leaf certificate management (#17075) 2023-06-13 10:54:45 -05:00
testing.go agent: remove agent cache dependency from service mesh leaf certificate management (#17075) 2023-06-13 10:54:45 -05:00
testing_api_gateway.go add order by locality failover to Consul enterprise (#16791) 2023-03-30 10:08:38 -04:00
testing_connect_proxy.go Rename hcp-metrics-collector to consul-telemetry-collector (#17327) 2023-05-16 14:36:05 -04:00
testing_ingress_gateway.go add order by locality failover to Consul enterprise (#16791) 2023-03-30 10:08:38 -04:00
testing_mesh_gateway.go [OSS] gRPC Blocking Queries (#17426) 2023-05-23 17:29:10 -04:00
testing_oss.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
testing_peering.go copyright headers for agent folder (#16704) 2023-03-28 14:39:22 -04:00
testing_terminating_gateway.go Add sameness groups to service intentions. (#17064) 2023-04-20 12:16:04 -04:00
testing_tproxy.go Avoid panic applying TProxy Envoy extensions (#17537) 2023-06-01 13:04:39 -04:00
testing_upstreams.go move enterprise test cases out of open source (#16985) 2023-04-13 09:07:06 -04:00
testing_upstreams_oss.go move enterprise test cases out of open source (#16985) 2023-04-13 09:07:06 -04:00
upstreams.go Fix multiple issues related to proxycfg health queries. (#17241) 2023-05-09 12:37:58 -05:00