| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Create claimed every sandbox with a hardcoded TTL of 0, so the node applied its default lease and every k8s-created sandbox lived exactly five minutes whatever the caller asked for. Nothing is stored on this path - the claim is the node's only chance to hear a lifetime. Create now derives ttl_seconds from spec.shutdownTime (rounded up to whole seconds), or from the sandbox.cocoonstack.io/ttl-seconds annotation for clients that cannot set the field - the same key the vk-cocoon-sandbox provider reads on pods, now defined once in package scale. Unusable lifetimes (a shutdownTime already past, a malformed annotation) are rejected with a 400 before a warm microVM is spent. The node's granted deadline now rides ClaimResult/Assignment back and is reported as spec.shutdownTime on the returned object: the node clamps the ask to its own default and maximum, so the grant - not the echo of the request - is the truth. Verified end-to-end on a two-node test cluster: a 90 s shutdownTime came back verbatim and the node reaped the sandbox five seconds after its deadline.
Test funcs before helpers so the layout gate passes; drop the internal/lifecycle import (TimeLeft with two nil args is t.Sub(now)); math.Ceil for the whole-second round-up; one-arm ShutdownTime echo; comments cut to the budget and the sibling module name corrected.
Only the aggregated apiserver reads the key; the scale definition had no second consumer, so the alias hop bought nothing.
Create no longer rewrites the submitted spec.shutdownTime; the node's granted expiry rides sandbox.cocoonstack.io/deadline beside the claim id and address. InventoryEntry gains an optional deadline so the synthesized Get/List path stamps the identical key once nodes publish it, and a refreshed deadline surfaces as a Modified entry.
| Back | FazBrowse Home | New Git URL |
Problem
The aggregated Create path claimed every sandbox with a hardcoded TTL of 0 (storage.go: r.store.Claim(ctx, namespace, name, pool, 0)), so sandboxd applied its default lease and every k8s-created Sandbox lived exactly 5 minutes — spec.shutdownTime and any requested lifetime were silently ignored. Nothing is stored on this path, so the claim body is the only moment the node can hear a lifetime.
Change
Testing