mirror of https://github.com/status-im/consul.git
72f991d8d3
* 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. |
||
---|---|---|
.. | ||
catalog_datacenters.go | ||
catalog_datacenters_test.go | ||
catalog_list_services.go | ||
catalog_list_services_test.go | ||
catalog_service_list.go | ||
catalog_service_list_test.go | ||
catalog_services.go | ||
catalog_services_test.go | ||
config_entry.go | ||
config_entry_test.go | ||
connect_ca_root.go | ||
connect_ca_root_test.go | ||
discovery_chain.go | ||
discovery_chain_test.go | ||
exported_peered_services.go | ||
exported_peered_services_test.go | ||
federation_state_list_gateways.go | ||
federation_state_list_gateways_test.go | ||
gateway_services.go | ||
gateway_services_test.go | ||
health_services.go | ||
health_services_test.go | ||
intention_match.go | ||
intention_match_test.go | ||
intention_upstreams.go | ||
intention_upstreams_destination.go | ||
intention_upstreams_destination_test.go | ||
intention_upstreams_test.go | ||
mock_PeeringLister_test.go | ||
mock_RPC.go | ||
mock_TrustBundleLister_test.go | ||
mock_TrustBundleReader_test.go | ||
node_services.go | ||
node_services_test.go | ||
options.go | ||
peered_upstreams.go | ||
peered_upstreams_test.go | ||
peerings.go | ||
peerings_test.go | ||
prepared_query.go | ||
prepared_query_test.go | ||
resolved_service_config.go | ||
resolved_service_config_test.go | ||
rpc.go | ||
service_checks.go | ||
service_checks_test.go | ||
service_dump.go | ||
service_dump_test.go | ||
service_gateways.go | ||
service_gateways_test.go | ||
testing.go | ||
trust_bundle.go | ||
trust_bundle_test.go | ||
trust_bundles.go | ||
trust_bundles_test.go |