mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-19 01:06:27 +00:00
Merge pull request #181 from justincormack/runtime-cgroups
Add Cgroups to runtime config
This commit is contained in:
commit
eceb6d11f8
@ -185,6 +185,7 @@ permissions issues in use.
|
|||||||
|
|
||||||
In addition to the parts of the specification above used to generate the OCI spec, there is a `runtime` section in the image specification
|
In addition to the parts of the specification above used to generate the OCI spec, there is a `runtime` section in the image specification
|
||||||
which specifies some actions to take place when the container is being started.
|
which specifies some actions to take place when the container is being started.
|
||||||
|
- `cgroups` takes a list of cgroups that will be created before the container is run.
|
||||||
- `mounts` takes a list of mount specifications (`source`, `destination`, `type`, `options`) and mounts them in the root namespace before the container is created. It will
|
- `mounts` takes a list of mount specifications (`source`, `destination`, `type`, `options`) and mounts them in the root namespace before the container is created. It will
|
||||||
try to make any missing destination directories.
|
try to make any missing destination directories.
|
||||||
- `mkdir` takes a list of directories to create at runtime, in the root mount namespace. These are created before the container is started, so they can be used to create
|
- `mkdir` takes a list of directories to create at runtime, in the root mount namespace. These are created before the container is started, so they can be used to create
|
||||||
|
@ -100,6 +100,7 @@ type Image struct {
|
|||||||
|
|
||||||
// Runtime is the type of config processed at runtime, not used to build the OCI spec
|
// Runtime is the type of config processed at runtime, not used to build the OCI spec
|
||||||
type Runtime struct {
|
type Runtime struct {
|
||||||
|
Cgroups *[]string `yaml:"cgroups" json:"cgroups,omitempty"`
|
||||||
Mounts *[]specs.Mount `yaml:"mounts" json:"mounts,omitempty"`
|
Mounts *[]specs.Mount `yaml:"mounts" json:"mounts,omitempty"`
|
||||||
Mkdir *[]string `yaml:"mkdir" json:"mkdir,omitempty"`
|
Mkdir *[]string `yaml:"mkdir" json:"mkdir,omitempty"`
|
||||||
Interfaces *[]Interface `yaml:"interfaces" json:"interfaces,omitempty"`
|
Interfaces *[]Interface `yaml:"interfaces" json:"interfaces,omitempty"`
|
||||||
@ -570,10 +571,12 @@ func assignRuntime(v1, v2 *Runtime) Runtime {
|
|||||||
if v2 == nil {
|
if v2 == nil {
|
||||||
v2 = &Runtime{}
|
v2 = &Runtime{}
|
||||||
}
|
}
|
||||||
|
runtimeCgroups := assignStrings(v1.Cgroups, v2.Cgroups)
|
||||||
runtimeMounts := assignBinds(v1.Mounts, v2.Mounts)
|
runtimeMounts := assignBinds(v1.Mounts, v2.Mounts)
|
||||||
runtimeMkdir := assignStrings(v1.Mkdir, v2.Mkdir)
|
runtimeMkdir := assignStrings(v1.Mkdir, v2.Mkdir)
|
||||||
runtimeInterfaces := assignRuntimeInterfaceArray(v1.Interfaces, v2.Interfaces)
|
runtimeInterfaces := assignRuntimeInterfaceArray(v1.Interfaces, v2.Interfaces)
|
||||||
runtime := Runtime{
|
runtime := Runtime{
|
||||||
|
Cgroups: &runtimeCgroups,
|
||||||
Mounts: &runtimeMounts,
|
Mounts: &runtimeMounts,
|
||||||
Mkdir: &runtimeMkdir,
|
Mkdir: &runtimeMkdir,
|
||||||
Interfaces: &runtimeInterfaces,
|
Interfaces: &runtimeInterfaces,
|
||||||
|
@ -239,6 +239,7 @@ var schema = string(`
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"cgroups": {"$ref": "#/definitions/strings"},
|
||||||
"mounts": {"$ref": "#/definitions/mounts"},
|
"mounts": {"$ref": "#/definitions/mounts"},
|
||||||
"mkdir": {"$ref": "#/definitions/strings"},
|
"mkdir": {"$ref": "#/definitions/strings"},
|
||||||
"interfaces": {"$ref": "#/definitions/interfaces"},
|
"interfaces": {"$ref": "#/definitions/interfaces"},
|
||||||
|
Loading…
Reference in New Issue
Block a user