Skip to content

review: whole-repo round — owning-node index, cache-fed warm pool, scoped informers, indexed queue - #11

Merged
CMGS merged 3 commits into
masterfrom
review/night-2026-09-03
Sep 2, 2026
Merged

review: whole-repo round — owning-node index, cache-fed warm pool, scoped informers, indexed queue#11
CMGS merged 3 commits into
masterfrom
review/night-2026-09-03

Conversation

@CMGS

@CMGS CMGS commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Whole-repo quality round for sandbox-operator.

Hot paths (same-machine Go benchmarks, before → after):

benchmark before after
StoreGet 26x100 86.4 µs / 239 KB / 153 allocs 4.5 µs / 13.5 KB / 17 allocs
StoreGet 200x2000 3.03 ms / 36.1 MB / 1035 allocs 38.9 µs / 217 KB / 17 allocs
StoreWarmCandidates 200x2000 2.32 ms / 36.2 MB 151 µs / 69 KB
e2b LookupByID 3.66 ms / 36.1 MB 68.9 µs / 218 KB
WarmPoolReconcileSteady 33.6 ms / 57.9 MB 30.7 ms / 34.4 MB
  • pkg/scale: a generation-bounded owning-node index answers repeat Get/GetByClaimID from one node's inventory and falls back to the fan-out on a miss; InventorySource.NodeCapacity returns address and pools without decoding entries (claim pick, lifecycle routing, warm-pool driver).
  • warm pool: the driver receives the apiserver's cache-fed inventory source instead of reading NodeInventory unstructured off the kube-apiserver on every trigger.
  • operator: Pod, Service and PVC informers are label-scoped (cache.Options.ByObject); the pod-count LIST is copy-free; warm-pool members and the metrics collector range by pointer; syncAdoptedSandboxMetadata compares before it deep-copies; Owns(&Sandbox{}) carries a predicate.
  • queue: moved to internal/queue on an indexed list — O(1) push/remove, no snapshot-and-retry, single-pass pickSmart; FIFO tie-break kept (TestSandboxClaimAdoptionStrategy proves it load-bearing).
  • correctness: over-cap sandboxd replies are reported (cap 16 MiB); deleteSnapshot returns 500 when every node failed and both snapshot fan-outs are bounded; Delete on a sandbox with no owning node fails loud; NetForAnnotations gives Create and the pool driver one net-axis resolver; InventoryEntry.Template makes templateID recoverable and envdAccessToken is no longer emitted on read paths; ClaimIDResolver is exported and required.
  • cuts: NodeInventoryPublisher, ClaimSnapshot, Promote, Client.Sandbox, SandboxPodTemplateHashLabel, two SandboxdClient methods; grpc v1.83.1.
  • docs: --default-runtime values, watch-backoff and latency claims, GET /sandboxes/{id} mapping, endAt, five undocumented flags, token/template limits, cache-scoping section; docs/api.md regenerated (ten registered types were missing) by the new pinned make api-docs target.
  • style: comment budget (net −480 comment lines), test files without comments, modern Go.

Held: the pkg/scale subpackage split (27 contract identifiers still live in the impl file and vk-sandbox imports four of them — lift the contract first); the two template Gets in syncAdoptedSandboxMetadata.

Gates: GOWORK=off make lint (0 issues on linux and darwin), make fmt-check, asl ./... on both GOOS, make vet-tagged, go test -race -count=1 ./... (16 packages ok). vk-sandbox builds against this tree in workspace mode.

CMGS added 3 commits September 3, 2026 03:20
…oped informers, indexed queue, comment budget

Repeat Get/GetByClaimID read one node's inventory through a generation-bounded
owning-node index (200x2000 lookup 3.03 ms/36 MB → 39 µs/217 KB); NodeCapacity
answers the claim pick and the warm-pool driver without decoding entries; the
warm-pool driver takes the apiserver's cache-fed inventory source instead of
reading NodeInventory off the kube-apiserver; the operator's Pod, Service and
PVC informers are label-scoped; the claim queue moves to internal/queue on an
indexed list with O(1) push/remove and a single-pass pickSmart. Over-cap
sandboxd replies are reported, snapshot fan-outs are bounded, Create and the
pool driver share one net-axis resolver, templateID is recoverable and
envdAccessToken is no longer emitted. Dead exports cut (NodeInventoryPublisher,
ClaimSnapshot, Promote, Client.Sandbox, SandboxPodTemplateHashLabel), grpc at
v1.83.1, docs corrected and docs/api.md regenerated by the new api-docs target.
…wner is an error; one-pass node spread

The claim watch compared only the Ready boolean, so a reason or message
change on a still-false condition never re-reconciled the owning claim; the
predicate now compares the whole condition like Finished. A DELETE whose
sandbox resolved to no owning node answered 204 without releasing anything and
now answers 500. pickSmart's spread pass reads the queue once. Test files
carry no comments (AST strip, directives kept), the inventory example names
the template field, and make help lists api-docs.
…commit carries no narration

A status-only update that moved observedGeneration was dropped by the
field-wise compare; the predicate now compares the complete condition.
@CMGS
CMGS merged commit 086d8ea into master Sep 2, 2026
2 checks passed
@CMGS
CMGS deleted the review/night-2026-09-03 branch September 2, 2026 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant