diff options
Diffstat (limited to 'src/sandbox/kata.rs')
| -rw-r--r-- | src/sandbox/kata.rs | 34 |
1 files changed, 7 insertions, 27 deletions
diff --git a/src/sandbox/kata.rs b/src/sandbox/kata.rs index e035fd6..2bdc472 100644 --- a/src/sandbox/kata.rs +++ b/src/sandbox/kata.rs @@ -18,7 +18,6 @@ use crate::sandbox::wire::{self, Frame}; use crate::sandbox::{Sandbox, SandboxBackend, SandboxInfo, SandboxSpec}; #[derive(Debug, Clone)] -// ProvisionRequest stays `pub`: the argument of `Provisioner::provision`, the trait the public `LocalAgentProvisioner` implements. pub struct ProvisionRequest { pub sandbox_id: String, pub profile: String, @@ -28,7 +27,6 @@ pub struct ProvisionRequest { pub image: String, } -// Provisioner stays `pub`: implemented by the test-gated public `LocalAgentProvisioner`; a private trait on a public impl is E0445. pub trait Provisioner: Send + Sync { fn provision(&self, req: &ProvisionRequest) -> Result<()>; fn reclaim(&self, sandbox_id: &str) -> Result<()>; @@ -36,10 +34,9 @@ pub trait Provisioner: Send + Sync { } /// The agent-sandbox-style CR: one disposable Sandbox per build, Kata for the -/// VM boundary, `activeDeadlineSeconds` so the *orchestrator* enforces the -/// TTL even if the hub dies. The token rides in args for v1; a production -/// deployment should mount it from a Secret, and this comment is the honest -/// place that says so. +/// VM boundary, `activeDeadlineSeconds` so the orchestrator enforces the TTL +/// even if the hub dies. The token rides in args; a production deployment +/// should mount it from a Secret. fn sandbox_cr(req: &ProvisionRequest) -> serde_json::Value { serde_json::json!({ "apiVersion": "agents.x-k8s.io/v1alpha1", @@ -123,13 +120,8 @@ impl Provisioner for K8sSandboxProvisioner { } } -/// Provisions sandboxes by running the local `sandbox-agent` binary. -/// -/// Test-tier only. Production selects `K8sSandboxProvisioner` when the config -/// names an agent-sandbox backend (kata.rs:193); nothing in the crate ever -/// constructs this type. It exists so tests can drive the real agent protocol -/// against the shim binary without a cluster, which is a more valuable test -/// than the absence of one — so it is gated rather than deleted. +/// Provisions sandboxes by running the local `sandbox-agent` binary, so tests +/// can drive the real agent protocol without a cluster. #[cfg(feature = "test-support")] pub struct LocalAgentProvisioner { pub bin: PathBuf, @@ -176,9 +168,7 @@ impl Provisioner for LocalAgentProvisioner { } } -/// The real definition and its impls. The module is private, so this `pub` -/// is not a nameable path from outside; the alias below is the only way to -/// reach it, and the alias is what carries the feature-conditional visibility. +/// The real definition and its impls; the alias below carries the visibility. mod kata_backend { use super::{ bounded, route_dial_in, wire, Arc, AtomicU64, Config, Duration, Error, Frame, HashMap, K8sSandboxProvisioner, @@ -252,13 +242,6 @@ mod kata_backend { }) } - // NOTE: `KataBackend::reclaim` used to sit here and called nothing but - // `self.provisioner.reclaim`, which the pool already calls itself at the - // reaping site. Nothing — not a test — ever called the wrapper, so it is - // gone rather than gated. The census had credited it to `tests/kata.rs`, - // where the TTL test implements the *trait's* `reclaim` on a null - // provisioner: same word, different function. - fn nonce(&self) -> String { let n = self.counter.fetch_add(1, Ordering::SeqCst); let nanos = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).map_or(0, |d| d.as_nanos()); @@ -298,10 +281,7 @@ mod kata_backend { } } -/// Selected by `backend_for`. The kata tests drive it directly and need a -/// fixture, so they cannot move into the module. -/// `pub` only under `test-support`. Production reaches the backend through -/// `backend_for` and never names the type from outside `sandbox`. +/// Selected by `backend_for`; the kata tests drive it directly. #[cfg(feature = "test-support")] pub use kata_backend::KataBackend; |
