consul/agent/cache-types
Nitya Dhanushkodi 78b170ad50
xds controller: setup watches for and compute leaf cert references in ProxyStateTemplate, and wire up leaf cert manager dependency (#18756)
* Refactors the leafcert package to not have a dependency on agent/consul and agent/cache to avoid import cycles. This way the xds controller can just import the leafcert package to use the leafcert manager.

The leaf cert logic in the controller:
* Sets up watches for leaf certs that are referenced in the ProxyStateTemplate (which generates the leaf certs too).
* Gets the leaf cert from the leaf cert cache
* Stores the leaf cert in the ProxyState that's pushed to xds
* For the cert watches, this PR also uses a bimapper + a thin wrapper to map leaf cert events to related ProxyStateTemplates

Since bimapper uses a resource.Reference or resource.ID to map between two resource types, I've created an internal type for a leaf certificate to use for the resource.Reference, since it's not a v2 resource.
The wrapper allows mapping events to resources (as opposed to mapping resources to resources)

The controller tests:
Unit: Ensure that we resolve leaf cert references
Lifecycle: Ensure that when the CA is updated, the leaf cert is as well

Also adds a new spiffe id type, and adds workload identity and workload identity URI to leaf certs. This is so certs are generated with the new workload identity based SPIFFE id.

* Pulls out some leaf cert test helpers into a helpers file so it
can be used in the xds controller tests.
* Wires up leaf cert manager dependency
* Support getting token from proxytracker
* Add workload identity spiffe id type to the authorize and sign functions



---------

Co-authored-by: John Murret <john.murret@hashicorp.com>
2023-09-12 12:56:43 -07:00
..
catalog_datacenters.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
catalog_datacenters_test.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
catalog_list_services.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
catalog_list_services_test.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
catalog_service_list.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
catalog_service_list_test.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
catalog_services.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
catalog_services_test.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
config_entry.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
config_entry_test.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
connect_ca_root.go xds controller: setup watches for and compute leaf cert references in ProxyStateTemplate, and wire up leaf cert manager dependency (#18756) 2023-09-12 12:56:43 -07:00
connect_ca_root_test.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
discovery_chain.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
discovery_chain_test.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
exported_peered_services.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
exported_peered_services_test.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
federation_state_list_gateways.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
federation_state_list_gateways_test.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
gateway_services.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
gateway_services_test.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
health_services.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
health_services_test.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
intention_match.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
intention_match_test.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
intention_upstreams.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
intention_upstreams_destination.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
intention_upstreams_destination_test.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
intention_upstreams_test.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
mock_PeeringLister_test.go Protobuf Refactoring for Multi-Module Cleanliness (#16302) 2023-02-17 16:14:46 -05:00
mock_RPC.go xds: don't attempt to load-balance sessions for local proxies (#15789) 2023-01-18 12:33:21 -06:00
mock_TrustBundleLister_test.go Protobuf Refactoring for Multi-Module Cleanliness (#16302) 2023-02-17 16:14:46 -05:00
mock_TrustBundleReader_test.go Protobuf Refactoring for Multi-Module Cleanliness (#16302) 2023-02-17 16:14:46 -05:00
node_services.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
node_services_test.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
options.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
peered_upstreams.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
peered_upstreams_test.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
peerings.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
peerings_test.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
prepared_query.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
prepared_query_test.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
resolved_service_config.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
resolved_service_config_test.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
rpc.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
service_checks.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
service_checks_test.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
service_dump.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
service_dump_test.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
service_gateways.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
service_gateways_test.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
testing.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
trust_bundle.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
trust_bundle_test.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
trust_bundles.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
trust_bundles_test.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00