Repository navigation
Conversation
7ad90b9 to
5bde8ea
Compare
|
taking a look! |
| if state.revision > pool.revision | ||
| || (state.revision == pool.revision && state.fingerprint != fingerprint) | ||
| { | ||
| return Err(invalid( | ||
| "warm pool configuration changed; increase its revision on all gateway replicas", | ||
| )); | ||
| } |
There was a problem hiding this comment.
The fingerprint hashes the whole driver config (L50), including the default supervisor and sandbox images, which are pinned to the gateway version. After an upgrade with an unchanged warm_pool.revision, this returns an error. The pool then stops refilling, aging out, and draining (even with enabled = false), and creates quietly go cold. Could a fingerprint change start a new pool generation and drain the old spares instead of erroring?
| let pools = self.template_warm_pools(Some(sandbox.id.clone())).await?; | ||
| let pools: Vec<_> = pools | ||
| .into_iter() | ||
| .filter(|pool| pool.workspace == sandbox.workspace && pool.target_size > 0) | ||
| .collect(); | ||
| if pools.is_empty() { | ||
| return Ok(None); | ||
| } | ||
| let trust = supervision | ||
| .warm_runtime_trust() | ||
| .await | ||
| .map_err(KubernetesDriverError::Message)?; | ||
| let inventory = self.warm_runtime_inventory(&sandbox.workspace).await?; | ||
| for pool in &pools { | ||
| let Some(snapshot) = supervision | ||
| .warm_pool_state(&pool.workspace, &pool.name) | ||
| .await | ||
| .map_err(KubernetesDriverError::Message)? | ||
| else { | ||
| continue; | ||
| }; | ||
| if snapshot.state.revision != pool.revision | ||
| || snapshot.state.fingerprint | ||
| != reconciler::fingerprint(&self.config, pool, &trust)? |
There was a problem hiding this comment.
Nothing has been claimed yet here, but any error (template lookup, trust, inventory, journal read, fingerprint) fails the whole create. The docs say creates fall back to cold creation. Could these return Ok(None), so a pool hiccup doesn't block creates?
| impl Default for WarmPoolSettings { | ||
| fn default() -> Self { | ||
| Self { | ||
| enabled: true, |
There was a problem hiding this comment.
Pooling defaults to on. Templates that already set --ready-within and --max-burst will start spare Pods after upgrading, and each dedicated spare costs two Pods. Since the docs call this experimental, should the default be false, or should the release notes call it out?
There was a problem hiding this comment.
The --ready-within and --max-burst options were added specifically as a means to configure warm pooling. I suspect no one is 'using' them yet, since prior to this PR those option have no effect whatsoever.
| () = &mut changed => {}, | ||
| // Other replicas commit to the same durable store. This is | ||
| // server-side observation, not a registration retry. | ||
| () = tokio::time::sleep(std::time::Duration::from_secs(1)) => {}, |
There was a problem hiding this comment.
Each pending RegisterSupervisor stream polls once a second, with no deadline and no per-route cap. Every poll calls dedicated_registration, which loads launch material from the credential store (prepared.rs:584) before checking whether the spare is claimed. With N spares, that's N credential-store reads per second. Could the poll check the assignment record first, load material only once it's claimed, and cap streams per route?
| sandbox_id: String::new(), | ||
| generation: retirement.generation.to_string(), | ||
| workspace: retirement.workspace.clone(), | ||
| phase: RecordPhase::Retired, |
There was a problem hiding this comment.
Retired tombstones are never deleted. That makes sense so a route can't be revived, but with a 1-hour max age they grow without limit and every reconcile pass scans them. Could they expire once the physical resource UID is confirmed gone?
4f8dd24 to
810e1e5
Compare
Signed-off-by: Gordon Sim <[email protected]>
…ce Secret reads Signed-off-by: Gordon Sim <[email protected]>
Fingerprint effective runtime inputs and retain compatible spares across revision changes. Preserve cleanup during configuration mismatches and persist drain decisions across replicas. Update regression tests, operator guidance, and the stale packaging driver-selection assertion. Signed-off-by: Gordon Sim <[email protected]>
…fails Signed-off-by: Gordon Sim <[email protected]>
Signed-off-by: Gordon Sim <[email protected]>
Signed-off-by: Gordon Sim <[email protected]>
Signed-off-by: Gordon Sim <[email protected]>
Signed-off-by: Gordon Sim <[email protected]>
Signed-off-by: Gordon Sim <[email protected]>
…nciliation Signed-off-by: Gordon Sim <[email protected]>
Signed-off-by: Gordon Sim <[email protected]>
Signed-off-by: Gordon Sim <[email protected]>
- Add warm_pool.refill_per_pass (default 4, 1..=64) to replace the fixed
per-pass refill and operation burst.
- Record whether a pool is suspended in the journal and report target,
ready, pending, retiring, revision, and suspended through
GetSandboxTemplate and `openshell sandbox template get`.
- Export openshell_warm_pool_claims_total{outcome},
openshell_warm_pool_claim_duration_seconds{outcome},
openshell_warm_pool_spares{state}, and
openshell_warm_pool_suspended_pools.
Signed-off-by: divesh <[email protected]>
Signed-off-by: divesh <[email protected]>
Default warm_pool.enabled to false. A disabled reconciler drains only pools that already have a journal and no longer writes journals for templates that were never pooled. Once a disabled pass finds no recorded pool, sandbox creates skip warm claim lookups and the cold launch fence, so gateways that never enable pooling keep the existing create path. Signed-off-by: divesh <[email protected]>
|
@grs can you PTAL again, I have added the following things on top of this feature
and @drew for viz |
Summary
Add template-driven warm pooling for Kubernetes sandboxes with dedicated or shared supervisors. Prepared runtimes wait for a claim, then receive their sandbox identity and credentials over existing supervisor connections, avoiding cold startup and claim-time Secret projection delays.
Related Issue
Closes #2157
Changes
Release Notes
Kubernetes sandbox templates can request warm capacity using --ready-within and --max-burst. Pooling supports dedicated and shared supervisors and creates no spares for templates without startup tuning. Sandbox creation falls back to cold provisioning when no compatible spare is available.
Testing
Checks appropriate to the affected code and behavior pass
Unit tests added/updated
E2E tests added/updated
Manual basic operation verified with both supervisor topologies.
Checklist