update taskOptions based on runtimeOptions when creating a task
Signed-off-by: Iceber Gu <caiwei95@hotmail.com>
This commit is contained in:
committed by
k8s-infra-cherrypick-robot
parent
c146996f3f
commit
a183b2d232
@@ -54,12 +54,9 @@ func WithRuntimePath(absRuntimePath string) NewTaskOpts {
|
||||
// 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, err := info.getRuncOptions()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
opts.TaskApiAddress = address
|
||||
opts.TaskApiVersion = version
|
||||
@@ -119,12 +116,9 @@ func WithCheckpointImagePath(path string) CheckpointTaskOpts {
|
||||
// WithRestoreImagePath sets image path for create option
|
||||
func WithRestoreImagePath(path string) NewTaskOpts {
|
||||
return func(ctx context.Context, c *Client, ti *TaskInfo) error {
|
||||
if ti.Options == nil {
|
||||
ti.Options = &options.Options{}
|
||||
}
|
||||
opts, ok := ti.Options.(*options.Options)
|
||||
if !ok {
|
||||
return errors.New("invalid runtime v2 options format")
|
||||
opts, err := ti.getRuncOptions()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
opts.CriuImagePath = path
|
||||
return nil
|
||||
@@ -134,12 +128,9 @@ func WithRestoreImagePath(path string) NewTaskOpts {
|
||||
// WithRestoreWorkPath sets criu work path for create option
|
||||
func WithRestoreWorkPath(path string) NewTaskOpts {
|
||||
return func(ctx context.Context, c *Client, ti *TaskInfo) error {
|
||||
if ti.Options == nil {
|
||||
ti.Options = &options.Options{}
|
||||
}
|
||||
opts, ok := ti.Options.(*options.Options)
|
||||
if !ok {
|
||||
return errors.New("invalid runtime v2 options format")
|
||||
opts, err := ti.getRuncOptions()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
opts.CriuWorkPath = path
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user