Repository navigation
ateapi: remove SandboxConfig from ActorTemplate - #2780
Dmitry Berkovich (dberkov) merged 6 commits into
Conversation
e7beb26 to
2268e05
Compare
Sandbox runtime and version selection live on the WorkerPool, via its sandboxClasses and the SandboxConfig the controller resolves for them, and are reported on WorkerStatus as DefaultRuntime and RestorableRuntimes, stamped onto WorkerAssignment and Snapshot during actor execution, and passed to atelet on Run and Restore. The ActorTemplate no longer has a say in which sandbox an actor runs in, so its sandbox_config field goes. ateapi still sends atelet the sandbox assets on Run and Restore; it now resolves them from the assigned worker's pool instead of the template: the pool's confirmed SandboxConfig at its default version, which is the runtime the worker reports as its default. WorkerPool.ResolvedSandboxConfig exposes that lookup. The scheduler's SandboxClass constraint is now the class of the snapshot the actor restores from rather than the template's, and empty on a cold boot. A snapshot's files, its durable volumes included, are written by one class's worker and read back by the same, so the class holds for every fidelity and is never relaxed; a cold-booting actor gets the class of the pools its workerSelector matches. Remove sandbox_config and the SandboxConfig message from ActorTemplate in ateapi.proto, drop its validation from ate-api-server, derive the ate.sandbox.class metric attribute from the actor's assignment or snapshot runtime, and remove sandboxConfig from kubectl-ate, e2e fixtures, demo and benchmark ActorTemplate manifests, and docs.
2268e05 to
f327538
Compare
| func resolveTemplateSandboxConfig( | ||
| // resolvePoolSandboxConfig resolves the SandboxConfig the controller confirmed | ||
| // for the WorkerPool of the actor's assigned worker. | ||
| func resolvePoolSandboxConfig( |
There was a problem hiding this comment.
Not needed in this PR: we should remove this once the atelet-side changes for resolving hash->assets have landed.
There was a problem hiding this comment.
yeah, hence added a todo to remove it after 2731 gets merged.
But currently, the sandbox asset is still being passed to the atelet. So, need to resolve the value for that I guess ?
There was a problem hiding this comment.
yes, need to keep the resolver for now.
| if worker.GetSandboxClass() == "" { | ||
| return false | ||
| } | ||
| if constraints.SandboxClass != "" && worker.GetSandboxClass() != constraints.SandboxClass { |
There was a problem hiding this comment.
when does constraints.SandboxClass == "" ? should we throw an error?
There was a problem hiding this comment.
When snapshotSandboxClass found no snapshot on the actor — the cold-boot case.
basically, this was case there earlier too, but Sandbox_class from the template and it was required filed on the template. This is now replaced with the sandbox class from with either of the snapshots.
https://github.com/agent-substrate/substrate/pull/2780/changes#diff-36ddf680db489a13b32821a56fe2ab2f8b358a80baa531bc78f61ce2e6d2ce0eL679-R701
added this behavior in the pr description too -
Behavior change to flag: a template with no workerSelector whose actor has no snapshot can be placed on a pool of any class. Previously sandboxConfig.sandboxClass alone pinned the class; now the selector has to.
With sandbox_config gone from ActorTemplate the helper returned an empty
template with nothing gVisor-specific about it, and its name suggested a
constraint the tests no longer place. The rest of the file already writes
&ateapipb.ActorTemplate{} inline, so do the same at its call sites.
…ndbox class With sandbox_config gone from ActorTemplate, the WorkerPool decides the sandbox class an actor runs in, and a template reaches a pool only through worker_selector. Say so on the field and in the API guide: a cluster with pools of more than one class needs a selector that points only at pools of the class the workload wants, since an actor booting with no snapshot and no selector may land on any class and keeps it from its first checkpoint on. The actor-level worker_selector only narrows the template's choice, so point it at the template field.
# Conflicts: # cmd/ateapi/internal/controlapi/workflow_suspend.go
…t-substrate#2879) Completes the removal of `sandbox_assets` from the `ate-api-server` -> `atelet` wire protocol following agent-substrate#2780 and agent-substrate#2781. Since `atelet` now resolves the pause image and sandbox binaries for `Run` and `Restore` directly from `sandbox_runtime` via its advertised-runtime index, `ate-api-server` no longer needs to resolve `SandboxConfig` or send `SandboxAssets` on `RunRequest` and `RestoreRequest`. - **`ateletpb` & validation**: Remove `sandbox_assets` from `RunRequest` and `RestoreRequest`, delete `SandboxAssets`, `ArchAssets`, and `AssetFile`, and make `sandbox_runtime` required on both RPCs. - **`cmd/ateapi` & RBAC**: Delete `sandbox_assets.go`, remove `sandboxConfigLister` and `workerPoolLister` from `ActorWorkflow` and `NewRPCService`, drop `sandboxconfigs` from `ate-api-server` RBAC, and require a non-nil `DefaultRuntime` in `scheduler.Applies`. - **`cmd/atelet`**: Read `op.sandboxClass` from `sandbox_runtime` in `Restore`, delete dead `recordFromRequest`, and replace `poolConfigName` with `WorkerPool.ResolvedSandboxConfig()`. - [ ] Tests pass - [ ] Appropriate changes to documentation are included in the PR
Follow-up to #2660 and #2755.
Sandbox runtime and version selection live on the
WorkerPool: itssandboxClassesentry resolves aSandboxConfig, atelet reports the enabled versions onWorkerStatusasdefaultRuntime/restorableRuntimes, and the chosen runtime is stamped ontoWorkerAssignmentandSnapshotand sent to atelet on Run and Restore. TheActorTemplateno longer has a say in which sandbox an actor runs in, so itssandbox_configfield goes.Breaking:
ActorTemplate.sandbox_configand theSandboxConfigmessage are removed from the Control API. ate-api-server rejects unknown fields, so manifests or clients still sendingsandboxConfigfail withInvalidArgument. Stored templates are unaffected (proto bytes; the old field is carried as unknown).kubectl ate get actortemplatesloses itsSANDBOX CLASScolumn.API
sandbox_configand theSandboxConfigmessage fromActorTemplateinateapi.proto, and its validation from ate-api-server.sandboxConfigfromkubectl-ateoutput, e2e fixtures, demo and benchmarkActorTemplatemanifests (sweperf included), and the docs.ateapi
sandbox_assetson Run/Restore is unchanged on the wire; ateapi now resolves it from the assigned worker's pool instead of the template:WorkerAssignment→WorkerPool→ the controller-confirmedSandboxConfig(WorkerPool.ResolvedSandboxConfig(), new) → default version.ActorWorkflowtakes aWorkerPoolListerfor this; thesandboxconfigsRBAC stays. Marked TODO: this lookup, both listers and the RBAC go once atelet resolves the version fromsandbox_runtimeandsandbox_assetsis dropped (the follow-up noted in atelet: pass SandboxRuntime on Run and Restore #2755).Constraints.SandboxClassis no longer taken from the template. It is the class of the snapshot the actor restores from (local, else latest durable, golden tags included), empty on a cold boot — so a worker of another class is never a candidate, not even as the volumes-only fallback whenRequiredRuntimeis relaxed. A cold-booting actor gets the class of the pools itsworkerSelectormatches.actor_templateon a SUSPENDED actor no longer requires the same SandboxConfig; the snapshot's class and runtime checks on resume cover compatibility.ate.sandbox.classon lifecycle and scheduler operations is derived from the actor's assignment or snapshot runtime rather than the template, and omitted when neither is known yet; registry updated.Behavior change to flag: a template with no
workerSelectorwhose actor has no snapshot can be placed on a pool of any class. PreviouslysandboxConfig.sandboxClassalone pinned the class; now the selector has to.Tests
TestResolveSandboxAssetscovers pool-based resolution (resolved, unresolved pool, missing pool, missing config, no default version).Appliescases for the snapshot-class pin;assignWorkerAttemptproves a microvm worker is never the fallback for a gvisor snapshot at MEMORY or VOLUMES fidelity.status.sandboxClasses[].configRefviaUpdateStatus(status subresource) and wait for it in the informer.ReleaseWindowWorkflowsmakes the worker ineligible viaworkerSelectorinstead of a sandbox-class mismatch.No atelet changes beyond two comments.