Skip to content

When creating a task, update taskOptions based on the container's runtimeOptions #11568

@Iceber

Description

@Iceber

Description

In the current version of containerd, only one of taskOptions and runtimeOptions is ever used.
When a user uses taskOptions in cri plugin or ctr, runtimeOptions is ignored when actually creating and running the task.

topts := opts.TaskOptions
if topts == nil || topts.GetValue() == nil {
topts = opts.RuntimeOptions
}
request := &task.CreateTaskRequest{
ID: s.ID(),
Bundle: s.Bundle(),

The taskOptions and runtimeOptions should not be mutually exclusive; they should have a good mergence.

I think the best place for this to happen is in the client, where task options can be specifically modified based on runtimeOptions.

This issue is similar to issue #11480, but the described content covers the reason for that issue.

k8s CI tests are failing after using user namespace kubernetes/test-infra#34510 (comment)

Steps to reproduce the issue

  1. mv /usr/bin/runc /tmp/runc
  2. ctr run --runc-binary /tmp/runc --no-pivot docker.io/library/ubuntu:latest test ps

Describe the results you received and expected

ctr: failed to create shim task: OCI runtime create failed: unable to retrieve OCI runtime error (open /run/containerd/io.containerd.runtime.v2.task/default/test-5/log.json: no such file or directory): exec: "runc": executable file not found in $PATH: unknown

I expect to be able to use the specified runc binary and successfully run the container.

What version of containerd are you using?

containerd github.com/containerd/containerd/v2 v2.0.4 1a43cb6

Any other relevant information

No response

Show configuration if it is related to CRI plugin.

No response

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions