diff options
| author | aur-build <aur-build@localhost> | 2026-11-19 11:49:50 +0000 |
|---|---|---|
| committer | aur-build <aur-build@localhost> | 2026-11-19 11:49:50 +0000 |
| commit | 2eb4500f089154b982f7c5dbbc7f1efbfd702ed5 (patch) | |
| tree | 6af449ea55d1dba0d3b8d685cf591ebec8d77eac /src/sandbox/agent.rs | |
| parent | 3374ffd34921e1de414e8b07f69753113f5ba5f9 (diff) | |
| download | aur-build-2eb4500f089154b982f7c5dbbc7f1efbfd702ed5.tar.gz aur-build-2eb4500f089154b982f7c5dbbc7f1efbfd702ed5.zip | |
sandbox: kata backend — ad-hoc TTL sandboxes over the agent protocol
The kata lease path is composition, not a new protocol: acquire mints a
rendezvous nonce, asks a Provisioner for a sandbox pointed at this hub,
and leases only the dial-in whose hello carries that nonce back. A box
that never dials in is a TTL expiry — the same vocabulary every other
failure here speaks (I5) — and a stray box that greets with a nonce
nobody ordered is dropped unread, never leased.
Two payload shapes are constructed as pure, unit-tested functions
because both are real targets: an agent-sandbox-style Kubernetes CR
(runtimeClass kata, activeDeadlineSeconds so the orchestrator enforces
the TTL even if the hub dies) and a nerdctl/containerd argv for hosts
without a cluster. The K8s provisioner is real ureq code exercised only
by the gated live tier, which skips with a printed note wherever
/dev/kvm or AUR_KATA_API is absent — the recorded-skip convention, not
a silent pass.
The rendezvous and TTL logic runs for real on any machine via
LocalAgentProvisioner: a real sandbox-agent process, real frames, real
nonce matching, no VM. That is the same honesty as the loopback
backend — the interface is under test, not a mock of it.
Diffstat (limited to 'src/sandbox/agent.rs')
| -rw-r--r-- | src/sandbox/agent.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/sandbox/agent.rs b/src/sandbox/agent.rs index 3964d2c..09a6f93 100644 --- a/src/sandbox/agent.rs +++ b/src/sandbox/agent.rs @@ -33,11 +33,18 @@ pub struct AgentOptions { pub token: String, pub profile: String, pub ttl: Duration, + /// The identity the hub knows this sandbox by. A provisioner (Kata CR, + /// containerd run, a test) passes the nonce it registered with the hub; + /// the hello frame carries it back so the rendezvous can be matched. + pub agent_id: Option<String>, } pub fn serve(opts: &AgentOptions) -> Result<()> { let stream = connect_with_retry(&opts.hub, Duration::from_secs(15))?; - let agent_id = format!("sandbox-{}", std::process::id()); + let agent_id = opts + .agent_id + .clone() + .unwrap_or_else(|| format!("sandbox-{}", std::process::id())); wire::write_frame( &mut stream.try_clone()?, &Frame::Hello { |
