infra
infra copied to clipboard
Improve the StorageLocal struct
- use pid to ensure we own the total space
- stop looking for foreign namespaces
- add tests to ensure functionality
- randomly look for available slot
- only return slot if we created it successfully
- no need to create a context timeout, we're only doing in memory things
[!NOTE] Refactors sandbox networking to use typed env config and PID-locked local namespace storage, updating pool/slot/storage APIs (context-aware release) and adding tests.
- Orchestrator • Sandbox Networking:
- Config: Introduce
network.Configwith*net.IPNetCIDRs and parser (ParseConfig,ParseIPNet); updatecfg.Parse/ParseBuilderto use custom env parsers.- Slot/Pool APIs:
Slotnow uses config-provided CIDRs; fields renamed (NamereplacesKey);NamespaceID/names follow PID-based scheme; remove global CIDR getters.Pool: uses newNewStorage(nodeID, config)andRelease(ctx, ...)flow; improved cleanup.- Storage:
- Interface changes:
Release(ctx, *Slot); factory no longer passes slots size (derived from config).- KV storage computes
slotsSizefrom config and uses slotNamefor KV keys.- Local storage rewritten: PID-file locking, random slot acquisition, no foreign namespace scanning, metrics added; supports custom storage dir.
- Tests: Add
config_test.gofor CIDR parsing andstorage_local_test.gofor lock/unlock and round-trip behavior.- API: Minor fix in template build status error path (early return).
Written by Cursor Bugbot for commit 1e76a51950450be9000e1fc87799a4e88dddd78e. This will update automatically on new commits. Configure here.
After reviewing, @ValentaTomas pointed out that Idx is used to generate IP addreses, which must not overlap across orchestrators on the same host. I'll need to do some more work to ensure that stays true.