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 <gsim@redhat.com>
…ce Secret reads Signed-off-by: Gordon Sim <gsim@redhat.com>
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 <gsim@redhat.com>
…fails Signed-off-by: Gordon Sim <gsim@redhat.com>
Signed-off-by: Gordon Sim <gsim@redhat.com>
Signed-off-by: Gordon Sim <gsim@redhat.com>
Signed-off-by: Gordon Sim <gsim@redhat.com>
Signed-off-by: Gordon Sim <gsim@redhat.com>
Signed-off-by: Gordon Sim <gsim@redhat.com>
…nciliation Signed-off-by: Gordon Sim <gsim@redhat.com>
Signed-off-by: Gordon Sim <gsim@redhat.com>
Signed-off-by: Gordon Sim <gsim@redhat.com>
- 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 <dgude@nvidia.com>
Signed-off-by: divesh <dgude@nvidia.com>
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 <dgude@nvidia.com>
|
@grs can you PTAL again, I have added the following things on top of this feature
and @drew for viz |
grs
left a comment
There was a problem hiding this comment.
warm pool status in API/CLI
I don’t think the addition of warm-pool implementation status to GetSandboxTemplate and the associated CLI is the right approach. Templates were deliberately designed to express desired, observable startup characteristics without coupling them to a particular implementation such as warm pooling.
The proposed fields expose pool maintenance and gateway configuration details, but don’t tell the template user whether the requested startup characteristics are being achieved. They belong in operator-facing diagnostics and metrics, rather than the template API.
I’ would prefer this API/CLI addition to be removed from the PR. If we add template status later, it should report observed startup outcomes against the requested characteristics, independently of how the driver delivers them.
skipping warm-pool checks
The cached “no pools” result is local to a replica and can become stale during rolling enablement. Another replica could create a pool and reserve a warm runtime before the cache refreshes; if creation retries on the disabled replica before that runtime is bound to the sandbox, it would skip both claim recovery and the cold-launch fence, potentially creating a second runtime.
If we want to optimise out warm-pooling overhead where it is not needed, it would in my view be safer and more targeted to make those checks conditional on eligibility recorded for the sandbox launch. Launches that cannot use a warm pool could safely skip coordination, provided claim admission enforces that decision. Eligible launches would retain recovery and fencing across retries, even if pooling is subsequently disabled.
metrics
The capacity gauges and suspended-pools gauge look useful. A reconciliation success/error counter would complement them: suspension is a configuration state, while reconciliation can fail independently because of Kubernetes or database errors. That would also help identify incomplete capacity observations, since failed pool passes are omitted from the totals.
I’m less convinced we need claim duration at this stage. End-to-end startup latency split by warm/cold launch would better demonstrate the feature’s benefit; claim duration mainly helps diagnose one stage. I’d prefer to replace it with end-to-end startup latency, or remove it for now if that work is better deferred to a subsequent PR.
For the outcome counters, recording needs to happen after the cold-launch fence and any claim recovery complete—otherwise a recorded cold outcome can subsequently become warm or fail. We should also clarify which creates enter the counters, so the resulting warm-hit rate has a well-defined denominator.
Configurable warm pool refill
I’m not convinced that warm_pool.refill_per_pass should be exposed as configuration at this point. What operational problem would lead someone to change it, and what guidance would we give them for choosing a value? It controls several kinds of work per reconciliation pass, rather than a predictable refill rate, so its effect depends on implementation details and deployment size. I’d prefer to retain the internal limit unless we have a concrete need for tuning it and can offer meaningful guidance. Making a constant configurable creates an interface we then need to support; it isn’t automatically an improvement.
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