Skip to content

Commit 4c8a03c

Browse files
author
James Hunt
committed
Updates from latest review comments:
- Moved VM-specific configuration into a "vm" object. - Rename "KernelConfig" to simply "Kernel". - Remove requirement that paths be absolute (it's permissable but not mandatory). - Added example of fully populated "vm" object to config.md. Signed-off-by: James Hunt <[email protected]>
1 parent cc226d7 commit 4c8a03c

3 files changed

Lines changed: 75 additions & 45 deletions

File tree

config.md

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -265,27 +265,40 @@ Annotations are key-value maps.
265265
}
266266
```
267267

268-
## ImagePath
268+
## VM
269269

270-
ImagePath is an optional absolute path to the root filesystem image used by virtual machine-based runtimes.
270+
VM is an optional object used by virtual machine-based runtimes.
271271

272-
This value refers to a path on the host (outside of the virtual machine).
272+
* **`imagePath`** (string, required) path to file that represents the root filesystem for the virtual machine.
273+
* **`kernel`** (object, required) specifies details of the kernel to boot the virtual machine with.
273274

274-
Note that this field is distinct from the **path** field in the (#Root-Configuration) section since in the context of a virtual machine-based runtime:
275+
Note that `imagePath` refers to a path on the host (outside of the virtual machine). This field is distinct from the **`path`** field in the (#Root-Configuration) section since in the context of a virtual machine-based runtime:
275276

276-
* **ImagePath** will represent the root filesystem for the virtual machine.
277-
* The container root filesystem specified by **path** will be mounted inside the virtual machine at a location chosen by the virtual machine-based runtime.
277+
* **`ImagePath`** will represent the root filesystem for the virtual machine.
278+
* The container root filesystem specified by **`path`** will be mounted inside the virtual machine at a location chosen by the virtual machine-based runtime.
278279

279-
The virtual machine-based runtime will use these two fields to arrange for **path** to be presented to the process to run as the root filesystem.
280+
The virtual machine-based runtime will use these two path fields to arrange for **`path`** to be presented to the process to run as the root filesystem.
280281

281-
## Kernel-configuration
282+
An example of a fully-populated `VM` object:
282283

283-
Used by VM-based runtimes only.
284+
```json
285+
"vm": {
286+
"imagePath": "path/to/rootfs.img",
287+
"kernel": {
288+
"path": "path/to/vmlinuz",
289+
"parameters": "foo=bar hello world",
290+
"initrd": "path/to/initrd.img"
291+
},
292+
}
293+
```
294+
295+
## Kernel
296+
297+
Used by virtual machine-based runtimes only.
284298

285-
* **`path`** (string, required) specifies an absolute path to the kernel
286-
used to boot the virtual machine.
299+
* **`path`** (string, required) specifies the path to the kernel used to boot the virtual machine.
287300
* **`parameters`** (string, optional) specifies a space-separated list of parameters to pass to the kernel.
288-
* **`initrd`** (string, optional) specifies an absolute path to an initial ramdisk to be used by the kernel.
301+
* **`initrd`** (string, optional) specifies the path to an initial ramdisk to be used by the virtual machine.
289302

290303
## Configuration Schema Example
291304

schema/schema.json

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -165,33 +165,44 @@
165165
}
166166
}
167167
},
168-
"imagePath": {
169-
"description": "absolute path to rootfs image on host system which is used for VM-based runtimes",
170-
"id": "https://opencontainers.org/schema/bundle/imagePath",
171-
"type": "string"
172-
},
173-
"kernelConfig": {
174-
"description": "kernel config used by VM-based runtimes",
175-
"id": "https://opencontainers.org/schema/bundle/kernelConfig",
168+
"vm": {
169+
"description": "configuration for virtual machine-based runtimes",
170+
"id": "https://opencontainers.org/schema/bundle/vm",
176171
"type": "object",
177-
"required": [
178-
"path"
172+
"required" : [
173+
"imagePath",
174+
"kernel"
179175
],
180176
"properties": {
181-
"path": {
182-
"id": "https://opencontainers.org/schema/bundle/kernelConfig/path",
183-
"description": "absolute path to kernel image",
177+
"imagePath": {
178+
"description": "path to rootfs image on host system which is used for VM-based runtimes",
179+
"id": "https://opencontainers.org/schema/bundle/vm/imagePath",
184180
"type": "string"
185181
},
186-
"parameters": {
187-
"description": "space-separated list of kernel parameters",
188-
"id": "https://opencontainers.org/schema/bundle/kernelConfig/parameters",
189-
"type": "string"
190-
},
191-
"initrd": {
192-
"description": "absolute path to initial ramdisk image",
193-
"id": "https://opencontainers.org/schema/bundle/kernelConfig/initrd",
194-
"type": "string"
182+
"kernel": {
183+
"description": "kernel config used by VM-based runtimes",
184+
"id": "https://opencontainers.org/schema/bundle/vm/kernel",
185+
"type": "object",
186+
"required": [
187+
"path"
188+
],
189+
"properties": {
190+
"path": {
191+
"id": "https://opencontainers.org/schema/bundle/vm/kernel/path",
192+
"description": "path to kernel image",
193+
"type": "string"
194+
},
195+
"parameters": {
196+
"description": "space-separated list of kernel parameters",
197+
"id": "https://opencontainers.org/schema/bundle/vm/kernel/parameters",
198+
"type": "string"
199+
},
200+
"initrd": {
201+
"description": "path to initial ramdisk image",
202+
"id": "https://opencontainers.org/schema/bundle/vm/kernel/initrd",
203+
"type": "string"
204+
}
205+
}
195206
}
196207
}
197208
},

specs-go/config.go

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,28 @@ type Spec struct {
2222
Hooks Hooks `json:"hooks"`
2323
// Annotations is an unstructured key value map that may be set by external tools to store and retrieve arbitrary metadata.
2424
Annotations map[string]string `json:"annotations,omitempty"`
25-
// KernelConfig specifies kernel-related configuration for virtual-machine-based runtimes.
26-
KernelConfig KernelConfig `json:"kernelConfig"`
27-
// ImagePath is the absolute path to the root filesystem image on the host which can be used by a virtual machine-based runtime.
28-
ImagePath string `json:"imagePath"`
25+
// VM specifies configuration for virtual machine-based runtimes.
26+
VM VM `json:"vm,omitempty"`
2927
// Linux is platform specific configuration for Linux based containers.
3028
Linux Linux `json:"linux" platform:"linux"`
3129
}
3230

33-
// KernelConfig contains information about the kernel to use for a virtual machine.
34-
type KernelConfig struct {
35-
// Path is the absolute path to the kernel used to boot the virtual machine.
31+
// VM contains information for virtual machine-based runtimes.
32+
type VM struct {
33+
// Kernel specifies kernel-related configuration for virtual machine-based runtimes.
34+
Kernel Kernel `json:"kernel"`
35+
// ImagePath is the path to the root filesystem image on the host which can be used by a virtual machine-based runtime.
36+
ImagePath string `json:"imagePath"`
37+
}
38+
39+
// Kernel contains information about the kernel to use for a virtual machine.
40+
type Kernel struct {
41+
// Path is the path to the kernel used to boot the virtual machine.
3642
Path string `json:"path"`
37-
// Parameters specifies kernel parameters to pass to the virtual machine.
38-
Parameters string `json:"parameters"`
39-
// InitRd is the absolute path to an initial ramdisk to be used by the kernel.
40-
InitRd string `json:"initrd"`
43+
// Parameters specifies parameters to pass to the kernel.
44+
Parameters string `json:"parameters,omitempty"`
45+
// InitRd is the path to an initial ramdisk to be used by the kernel.
46+
InitRd string `json:"initrd,omitempty"`
4147
}
4248

4349
// Process contains information to start a specific application inside the container.

0 commit comments

Comments
 (0)