Merge pull request #9736 from abel-von/sandbox-task-0201

sandbox: Store bootstrap parameters in sandbox metadata and shim get them from sandbox metadata rather than other shim's bootstrap.json file.
This commit is contained in:
Fu Wei
2024-05-02 15:35:29 +00:00
committed by GitHub
19 changed files with 474 additions and 239 deletions

View File

@@ -50,6 +50,23 @@ func WithRuntimePath(absRuntimePath string) NewTaskOpts {
}
}
// WithTaskAPIEndpoint allow task service to manage a task through a given endpoint,
// usually it is served inside a sandbox, and we can get it from sandbox status.
func WithTaskAPIEndpoint(address string, version uint32) NewTaskOpts {
return func(ctx context.Context, client *Client, info *TaskInfo) error {
if info.Options == nil {
info.Options = &options.Options{}
}
opts, ok := info.Options.(*options.Options)
if !ok {
return errors.New("invalid runtime v2 options format")
}
opts.TaskApiAddress = address
opts.TaskApiVersion = version
return nil
}
}
// WithTaskCheckpoint allows a task to be created with live runtime and memory data from a
// previous checkpoint. Additional software such as CRIU may be required to
// restore a task from a checkpoint