add task api endpoint in task create options
Signed-off-by: Abel Feng <fshb1988@gmail.com>
This commit is contained in:
@@ -50,6 +50,24 @@ 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, protocol 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.TaskApiProtocol = protocol
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user