consul/agent/grpc-external/services/resource
R.B. Boyer c029b20615
v2: ensure the controller caches are fully populated before first use (#20421)
The new controller caches are initialized before the DependencyMappers or the 
Reconciler run, but importantly they are not populated. The expectation is that 
when the WatchList call is made to the resource service it will send an initial 
snapshot of all resources matching a single type, and then perpetually send 
UPSERT/DELETE events afterward. This initial snapshot will cycle through the 
caching layer and will catch it up to reflect the stored data.

Critically the dependency mappers and reconcilers will race against the restoration 
of the caches on server startup or leader election. During this time it is possible a
 mapper or reconciler will use the cache to lookup a specific relationship and 
not find it. That very same reconciler may choose to then recompute some 
persisted resource and in effect rewind it to a prior computed state.

Change

- Since we are updating the behavior of the WatchList RPC, it was aligned to 
  match that of pbsubscribe and pbpeerstream using a protobuf oneof instead of the enum+fields option.

- The WatchList rpc now has 3 alternating response events: Upsert, Delete, 
  EndOfSnapshot. When set the initial batch of "snapshot" Upserts sent on a new 
  watch, those operations will be followed by an EndOfSnapshot event before beginning 
  the never-ending sequence of Upsert/Delete events.

- Within the Controller startup code we will launch N+1 goroutines to execute WatchList 
  queries for the watched types. The UPSERTs will be applied to the nascent cache
   only (no mappers will execute).

- Upon witnessing the END operation, those goroutines will terminate.

- When all cache priming routines complete, then the normal set of N+1 long lived 
watch routines will launch to officially witness all events in the system using the 
primed cached.
2024-02-02 15:11:05 -06:00
..
testing resource: add MutateAndValidate endpoint (#20311) 2024-01-25 13:12:30 -06:00
delete.go resource: retry non-CAS deletes automatically (#20292) 2024-01-22 06:45:01 -08:00
delete_ce.go resource: block default namespace deletion + test refactorings (#19822) 2023-12-05 14:00:06 -05:00
delete_test.go resource: retry non-CAS deletes automatically (#20292) 2024-01-22 06:45:01 -08:00
list.go Add Common Controller Caching Infrastructure (#19767) 2023-12-13 10:06:39 -05:00
list_by_owner.go Add Common Controller Caching Infrastructure (#19767) 2023-12-13 10:06:39 -05:00
list_by_owner_test.go resource: block default namespace deletion + test refactorings (#19822) 2023-12-05 14:00:06 -05:00
list_test.go Add Common Controller Caching Infrastructure (#19767) 2023-12-13 10:06:39 -05:00
mock_ACLResolver.go Check acls on resource `Read`, `List`, and `WatchList` (#16842) 2023-04-11 06:10:14 -05:00
mock_Backend.go resource: List resources by owner (#17190) 2023-05-08 12:26:19 -05:00
mock_Registry.go Check acls on resource `Read`, `List`, and `WatchList` (#16842) 2023-04-11 06:10:14 -05:00
mock_TenancyBridge.go resource: Make resource write tenancy aware (#18423) 2023-08-10 09:53:38 -05:00
mutate_and_validate.go resource: add MutateAndValidate endpoint (#20311) 2024-01-25 13:12:30 -06:00
mutate_and_validate_test.go resource: add MutateAndValidate endpoint (#20311) 2024-01-25 13:12:30 -06:00
read.go Add Common Controller Caching Infrastructure (#19767) 2023-12-13 10:06:39 -05:00
read_test.go resource: block default namespace deletion + test refactorings (#19822) 2023-12-05 14:00:06 -05:00
server.go Remove V2 PeerName field from pbresource.Tenancy (#19865) 2024-01-29 15:08:31 -05:00
server_ce.go resource: resource service now checks for `v2tenancy` feature flag (#19400) 2023-10-27 08:55:02 -05:00
server_ce_test.go resource: block default namespace deletion + test refactorings (#19822) 2023-12-05 14:00:06 -05:00
server_test.go Remove V2 PeerName field from pbresource.Tenancy (#19865) 2024-01-29 15:08:31 -05:00
watch.go v2: ensure the controller caches are fully populated before first use (#20421) 2024-02-02 15:11:05 -06:00
watch_test.go v2: ensure the controller caches are fully populated before first use (#20421) 2024-02-02 15:11:05 -06:00
write.go resource: add MutateAndValidate endpoint (#20311) 2024-01-25 13:12:30 -06:00
write_mav_common_test.go Remove V2 PeerName field from pbresource.Tenancy (#19865) 2024-01-29 15:08:31 -05:00
write_status.go Remove V2 PeerName field from pbresource.Tenancy (#19865) 2024-01-29 15:08:31 -05:00
write_status_test.go resource: retry non-CAS deletes automatically (#20292) 2024-01-22 06:45:01 -08:00
write_test.go resource: add MutateAndValidate endpoint (#20311) 2024-01-25 13:12:30 -06:00