Skip to content

daemon: allow shimv2 runtimes to be configured#45032

Merged
thaJeztah merged 1 commit intomoby:masterfrom
corhere:shim-opts
Mar 2, 2023
Merged

daemon: allow shimv2 runtimes to be configured#45032
thaJeztah merged 1 commit intomoby:masterfrom
corhere:shim-opts

Conversation

@corhere
Copy link
Contributor

@corhere corhere commented Feb 17, 2023

Kubernetes only permits RuntimeClass values which are valid lowercase RFC 1123 labels, which disallows the period character. This prevents cri-dockerd from being able to support configuring alternative shimv2 runtimes for a pod as shimv2 runtime names must contain at least one period character.

- What I did

  • Added support for configuring named shimv2 runtimes in daemon.json so that runtime names can be aliased to Kubernetes-compatible names.
  • Added support for setting options for shimv2 runtimes in daemon.json.

- How I did it

I took heavy inspiration from cri-containerd configuration and its implementation. The names of the new daemon runtime config fields have been selected to correspond with the equivalent field names in cri-containerd's configuration so that users can more easily follow documentation from the runtime vendor written for cri-containerd and apply it to daemon.json.

- How to verify it

Create a /etc/docker/daemon.json containing

{
	"runtimes": {
		"custom": {
			"runtime-type": "io.containerd.runc.v2",
			"options": {
			       "BinaryName": "/usr/local/bin/doesnotexist"
			}
		}
	}
}

and (re)start the daemon. Try running a container with that runtime and examine the error message to see if the BinaryName option was respected.

$ docker run --rm --runtime custom alpine ls
docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: unable to retrieve OCI runtime error (open /var/run/docker/containerd/daemon/io.containerd.runtime.v2.task/moby/0c07ce57ea72bc26d0ffa0d1501506329fb15054e56072c076f0efc56f7eb342/log.json: no such file or directory): fork/exec /usr/local/bin/doesnotexist: no such file or directory: unknown.

- Description for the changelog

  • Alternative runtimes can now be configured in daemon.json, enabling runtime names to be aliased and options to be passed.

- A picture of a cute animal (not mandatory but encouraged)

@corhere corhere added kind/feature Functionality or other elements that the project doesn't currently have. Features are new and shiny impact/changelog area/daemon Core Engine impact/documentation labels Feb 17, 2023
@corhere corhere added this to the v-next milestone Feb 17, 2023
@corhere corhere requested a review from cpuguy83 as a code owner February 17, 2023 19:42
@neersighted neersighted added the area/runtime Runtime label Feb 17, 2023
Kubernetes only permits RuntimeClass values which are valid lowercase
RFC 1123 labels, which disallows the period character. This prevents
cri-dockerd from being able to support configuring alternative shimv2
runtimes for a pod as shimv2 runtime names must contain at least one
period character. Add support for configuring named shimv2 runtimes in
daemon.json so that runtime names can be aliased to
Kubernetes-compatible names.

Allow options to be set on shimv2 runtimes in daemon.json.

The names of the new daemon runtime config fields have been selected to
correspond with the equivalent field names in cri-containerd's
configuration so that users can more easily follow documentation from
the runtime vendor written for cri-containerd and apply it to
daemon.json.

Signed-off-by: Cory Snider <csnider@mirantis.com>
Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (from discussing and looking over)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/daemon Core Engine area/runtime Runtime docs/revisit impact/changelog impact/documentation kind/feature Functionality or other elements that the project doesn't currently have. Features are new and shiny status/2-code-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants