Skip to content

Commit da05912

Browse files
author
James O. D. Hunt
committed
Add VM-based runtime configuration details.
Add configuration details for virtual-machine-based runtimes. Signed-off-by: James O. D. Hunt <[email protected]>
1 parent a5276ae commit da05912

File tree

5 files changed

+109
-0
lines changed

5 files changed

+109
-0
lines changed

config-vm.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Virtual-machine-specific Configuration
2+
3+
Virtual-machine-based runtimes require additional configuration to that specified in the [default spec configuration](config.md).
4+
5+
This optional configuration is specified in a "VM" object:
6+
7+
* **`imagePath`** (string, required) path to file that represents the root filesystem for the virtual machine.
8+
* **`kernel`** (object, required) specifies details of the kernel to boot the virtual machine with.
9+
10+
Note that `imagePath` refers to a path on the host (outside of the virtual machine).
11+
This field is distinct from the **`path`** field in the [Root Configuration](config.md#Root-Configuration) section since in the context of a virtual-machine-based runtime:
12+
13+
* **`imagePath`** will represent the root filesystem for the virtual machine.
14+
* The container root filesystem specified by **`path`** from the [Root Configuration](config.md#Root-Configuration) section will be mounted inside the virtual machine at a location chosen by the virtual-machine-based runtime.
15+
16+
The virtual-machine-based runtime will use these two path fields to arrange for the **`path`** from the [Root Configuration](config.md#Root-Configuration) section to be presented to the process to run as the root filesystem.
17+
18+
## Kernel
19+
20+
Used by virtual-machine-based runtimes only.
21+
22+
* **`path`** (string, required) specifies the path to the kernel used to boot the virtual machine.
23+
* **`parameters`** (string, optional) specifies a space-separated list of parameters to pass to the kernel.
24+
* **`initrd`** (string, optional) specifies the path to an initial ramdisk to be used by the virtual machine.
25+
26+
## Example of a fully-populated `VM` object
27+
28+
```json
29+
"vm": {
30+
"imagePath": "path/to/rootfs.img",
31+
"kernel": {
32+
"path": "path/to/vmlinuz",
33+
"parameters": "foo=bar hello world",
34+
"initrd": "path/to/initrd.img"
35+
},
36+
}
37+
```

config.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,12 @@ Instead they MUST ignore unknown properties.
462462
Runtimes that are reading or processing this configuration file MUST generate an error when invalid or unsupported values are encountered.
463463
Unless support for a valid value is explicitly required, runtimes MAY choose which subset of the valid values it will support.
464464

465+
## VM
466+
467+
VM is an optional object used by virtual-machine-based runtimes.
468+
469+
See [Virtual-machine-specific schema](config-vm.md) for details.
470+
465471
## Configuration Schema Example
466472

467473
Here is a full example `config.json` for reference.

schema/config-schema.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,9 @@
191191
}
192192
}
193193
},
194+
"vm": {
195+
"$ref": "schema-vm.json#/vm"
196+
},
194197
"linux": {
195198
"$ref": "config-linux.json#/linux"
196199
},

schema/schema-vm.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"vm": {
3+
"description": "configuration for virtual-machine-based runtimes",
4+
"id": "https://opencontainers.org/schema/bundle/vm",
5+
"type": "object",
6+
"required" : [
7+
"imagePath",
8+
"kernel"
9+
],
10+
"properties": {
11+
"imagePath": {
12+
"description": "path to rootfs image on host system which is used for VM-based runtimes",
13+
"id": "https://opencontainers.org/schema/bundle/vm/imagePath",
14+
"type": "string"
15+
},
16+
"kernel": {
17+
"description": "kernel config used by VM-based runtimes",
18+
"id": "https://opencontainers.org/schema/bundle/vm/kernel",
19+
"type": "object",
20+
"required": [
21+
"path"
22+
],
23+
"properties": {
24+
"path": {
25+
"id": "https://opencontainers.org/schema/bundle/vm/kernel/path",
26+
"description": "path to kernel image",
27+
"type": "string"
28+
},
29+
"parameters": {
30+
"description": "space-separated list of kernel parameters",
31+
"id": "https://opencontainers.org/schema/bundle/vm/kernel/parameters",
32+
"type": "string"
33+
},
34+
"initrd": {
35+
"description": "path to initial ramdisk image",
36+
"id": "https://opencontainers.org/schema/bundle/vm/kernel/initrd",
37+
"type": "string"
38+
}
39+
}
40+
}
41+
}
42+
}
43+
}

specs-go/config.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ type Spec struct {
1818
Hooks *Hooks `json:"hooks,omitempty" platform:"linux,solaris"`
1919
// Annotations contains arbitrary metadata for the container.
2020
Annotations map[string]string `json:"annotations,omitempty"`
21+
// VM specifies configuration for virtual-machine-based runtimes.
22+
VM VM `json:"vm,omitempty"`
2123

2224
// Linux is platform-specific configuration for Linux based containers.
2325
Linux *Linux `json:"linux,omitempty" platform:"linux"`
@@ -27,6 +29,24 @@ type Spec struct {
2729
Windows *Windows `json:"windows,omitempty" platform:"windows"`
2830
}
2931

32+
// VM contains information for virtual-machine-based runtimes.
33+
type VM struct {
34+
// Kernel specifies kernel-related configuration for virtual-machine-based runtimes.
35+
Kernel Kernel `json:"kernel"`
36+
// ImagePath is the path to the root filesystem image on the host which can be used by a virtual-machine-based runtime.
37+
ImagePath string `json:"imagePath"`
38+
}
39+
40+
// Kernel contains information about the kernel to use for a virtual machine.
41+
type Kernel struct {
42+
// Path is the path to the kernel used to boot the virtual machine.
43+
Path string `json:"path"`
44+
// Parameters specifies parameters to pass to the kernel.
45+
Parameters string `json:"parameters,omitempty"`
46+
// InitRd is the path to an initial ramdisk to be used by the kernel.
47+
InitRd string `json:"initrd,omitempty"`
48+
}
49+
3050
// Process contains information to start a specific application inside the container.
3151
type Process struct {
3252
// Terminal creates an interactive terminal for the container.

0 commit comments

Comments
 (0)