consul/internal/controller
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
..
cache Fix panic on error (#20377) 2024-01-29 17:44:13 +00:00
controllermock Add Common Controller Caching Infrastructure (#19767) 2023-12-13 10:06:39 -05:00
controllertest In-Memory gRPC (#19942) 2024-01-12 11:54:07 -05:00
dependency Fix filename with two periods (#20389) 2024-01-29 15:38:40 -05:00
testdata Prevent circular dependencies between v2 resources and generate a mermaid diagram with their dependencies (#19230) 2023-10-18 10:55:32 -04:00
.mockery.yaml Add Common Controller Caching Infrastructure (#19767) 2023-12-13 10:06:39 -05:00
controller.go Remove V2 PeerName field from pbresource.Tenancy (#19865) 2024-01-29 15:08:31 -05:00
controller_test.go Add a separate test for initializer retries (#20298) 2024-01-19 16:59:44 -06:00
custom_watch.go Add Common Controller Caching Infrastructure (#19767) 2023-12-13 10:06:39 -05:00
dependencies.go [NET-6426] Add gateway proxy controller that generates empty proxy state template (#19901) 2023-12-21 16:37:47 -05:00
dependencies_test.go Prevent circular dependencies between v2 resources and generate a mermaid diagram with their dependencies (#19230) 2023-10-18 10:55:32 -04:00
doc.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
helper.go mesh: Add ComputedProxyConfiguration and a controller that computes it. (#19043) 2023-10-10 17:34:53 -06:00
helper_test.go mesh: create new routes-controller to reconcile xRoute types into a ComputedRoutes resource (#18460) 2023-09-12 12:08:51 -05:00
lease.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
manager.go Add Common Controller Caching Infrastructure (#19767) 2023-12-13 10:06:39 -05:00
mem_consistency_test.go v2: ensure the controller caches are fully populated before first use (#20421) 2024-02-02 15:11:05 -06:00
runner.go v2: ensure the controller caches are fully populated before first use (#20421) 2024-02-02 15:11:05 -06:00
supervisor.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
supervisor_test.go [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
testing.go Update workload health controller to use the controller cache (#20240) 2024-01-18 16:30:11 -05:00
watch.go Add Common Controller Caching Infrastructure (#19767) 2023-12-13 10:06:39 -05:00