Repository navigation
Incremental state step 2: central recompute and diff - #629
Conversation
|
Thanks for this, it's a big step forward. The structure is what Before we merge, please fix the following. Correctness bugs
Design problems
Cleanup
Rebase
|
Centralize input tracking in State with monotonic revision counter stamped on actual input modifications, including GatewayClass and Gateway addresses. Implement pure ComputeOutputs calculating desired statuses, proxy configuration, certificates, and resolved gateways from ModelInputs. Centralize recompute and diffing in State with debounced/coalesced background loop and per-kind event channels for changed objects. Simplify all controllers to record inputs into State and write status via WatchesRawSource channels, deleting all 19 cross-object mapping functions. Update proxy configuration and invoke OnGatewaysUpdate centrally once per recompute when proxy outputs change. Add unit tests verifying diffing, dependency updates without mapping functions, and a benchmark for recomputation scale. Add conformance & architecture journal for Step 2. Fixes gke-labs#628
- Feed State directly from informer event handlers and wait for HasSynced before initial recomputation - Deliver reconcile requests directly to controller workqueues via custom EventSource - Skip Gateways whose GatewayClass is not managed by our controller and add test - Execute proxy updates and onGatewaysUpdate outside State.mu - Remove fallback compilation from reconcilers and delete unneeded non-status reconcilers - Initialize managedGatewayClasses map so unrecorded classes compile no gateways - Maintain deterministic route parents ordering (gke-labs#627) and restore deleted comments
ab3a02d to
fd072c8
Compare
|
Thanks, this revision addresses nearly everything. The no-drop Bugs
Cleanup
Items 1 and 2 should be fixed in this PR, since #624 will build on it; 3 to 5 are small. |
- Ensure informer event handlers are the single source of Kubernetes inputs - Check GatewayFilter directly in State so filtered Gateways never enter state or proxy config - Strip out all remaining Gateway/parent upserts and deletes from reconcilers - Buffer pending reconcile events in EventSource until controller Start flushes them - Remove EventSource.testCh test hook and use real workqueue in unit tests - Unify recompute paths with recomputeMu to guarantee serialized recomputation and lock-free callbacks
Incremental state: follow-ups from #629 review
Implements Step 2 of docs/incremental-state.md ("Central recompute and diff").
Key Changes
State:GatewayClassandGatewayAddressesare recorded intoState.uint64) only on actual input mutations (spec, relevant metadata labels, secret data, configmap data, service ports/IP, etc.).len(gw.Status.Addresses) > 0inCompileModelso status computation never reads the status we wrote.ComputeOutputs):LastTransitionTimeand foreign controller entries) happens purely at write time.Statecentrally recomputes and diffs desired statuses against previous outputs, emitting change events on per-kind channels.OnGatewaysUpdatecentrally once per recompute when outputs change.Stateand write merged status viaWatchesRawSource(source.Channel(...)).EnqueueRequestsFromMapFuncmapping functions across all reconcilers.pkg/state/state_test.goverifying diffing and dependency propagation without mapping functions (e.g. Namespace label change, ReferenceGrant deletion, ConfigMap corruption).BenchmarkState_Recomputeinpkg/state/state_benchmark_test.gotesting 100 Gateways and 1000 HTTPRoutes (~6.7ms per recompute).Fixes #628