Skip to content
This repository was archived by the owner on Mar 9, 2022. It is now read-only.
This repository was archived by the owner on Mar 9, 2022. It is now read-only.

Custom Runtime Spec Defaults #1488

@crosbymichael

Description

@crosbymichael

There are many different defaults that an operator would want to change when it comes to the container runtime. Anything from rlimits, capabilities, or default mounts are fields that could be configurable in a deployment. Right now, CRI does not have a way to specify this at the daemon level.

I would like to add defaults to the daemon for runtime configuration on how the default runtime spec is created. However, I would also like to prevent having many fields in the daemon's configuration for an ever growing number of runtime options that a operator could want to change.

To solve both these requirements, I would like to propose custom spec defaults by changing the default spec. Currently all specs are created from a static, compiled in struct with default options.
ref: https://github.com/containerd/cri/blob/master/pkg/server/container_create.go#L291

This function uses the default found in the oci package as the base spec that all container's are created from. I want to add a simple daemon level option called base_runtime_spec which is a path to a serialized runtime spec on disk.

base_runtime_spec = "/etc/containerd/cri-base.json"

This would allow an operator to change ANYTHING on the spec to suit their needs and is forward compatible with all future runtime spec changes. The only read code change we would need in this codebase is to read this spec from disk and subsitute it in pace of the GenerateSpec's default, compiled in struct.

Issues:

However, there could be a few issues because of the way CRI handles the spec. It looks like functions and opts will unset or replace a lot of options on the spec and will need to be accounted for.

ref: https://github.com/containerd/cri/blob/master/pkg/server/container_create_unix.go#L115

Comments, questions, concerns?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions