Skip to content

Commit d810dbc

Browse files
authored
Merge pull request #976 from cwilhit/master
config: Add Windows Devices to Schema
2 parents 34fd552 + 65fac2b commit d810dbc

File tree

5 files changed

+67
-0
lines changed

5 files changed

+67
-0
lines changed

config-windows.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,34 @@ The Windows container specification uses APIs provided by the Windows Host Compu
1919
}
2020
```
2121

22+
## <a name="configWindowsDevices" />Devices
23+
24+
**`devices`** (array of objects, OPTIONAL) lists devices that MUST be available in the container.
25+
26+
Each entry has the following structure:
27+
28+
* **`id`** *(string, REQUIRED)* - specifies the device which the runtime MUST make available in the container.
29+
* **`idType`** *(string, REQUIRED)* - tells the runtime how to interpret `id`. Today, Windows only supports a value of `class`, which identifies `id` as a [device interface class GUID][interfaceGUID].
30+
31+
[interfaceGUID]: https://docs.microsoft.com/en-us/windows-hardware/drivers/install/overview-of-device-interface-classes
32+
33+
### Example
34+
35+
```json
36+
"windows": {
37+
"devices": [
38+
{
39+
"id": "24E552D7-6523-47F7-A647-D3465BF1F5CA",
40+
"idType": "class"
41+
},
42+
{
43+
"id": "5175d334-c371-4806-b3ba-71fd53c9258d",
44+
"idType": "class"
45+
}
46+
]
47+
}
48+
```
49+
2250
## <a name="configWindowsResources" />Resources
2351

2452
You can configure a container's resource limits via the OPTIONAL `resources` field of the Windows configuration.

schema/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ The layout of the files is as follows:
1313
* [state-schema.json](state-schema.json) - the primary entrypoint for the [state JSON](../runtime.md#state) schema
1414
* [defs.json](defs.json) - definitions for general types
1515
* [defs-linux.json](defs-linux.json) - definitions for Linux-specific types
16+
* [defs-windows.json](defs-windows.json) - definitions for Windows-specific types
1617
* [validate.go](validate.go) - validation utility source code
1718

1819

schema/config-windows.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
},
1111
"minItems": 1
1212
},
13+
"devices": {
14+
"type": "array",
15+
"items": {
16+
"$ref": "defs-windows.json#/definitions/Device"
17+
}
18+
},
1319
"resources": {
1420
"type": "object",
1521
"properties": {

schema/defs-windows.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"definitions": {
3+
"Device": {
4+
"type": "object",
5+
"properties": {
6+
"id": {
7+
"type": "string"
8+
},
9+
"idType": {
10+
"type": "string",
11+
"enum": [
12+
"class"
13+
]
14+
}
15+
},
16+
"required": [
17+
"id",
18+
"idType"
19+
]
20+
}
21+
}
22+
}

specs-go/config.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,8 @@ type SolarisAnet struct {
433433
type Windows struct {
434434
// LayerFolders contains a list of absolute paths to directories containing image layers.
435435
LayerFolders []string `json:"layerFolders"`
436+
// Devices are the list of devices to be mapped into the container.
437+
Devices []WindowsDevice `json:"devices,omitempty"`
436438
// Resources contains information for handling resource constraints for the container.
437439
Resources *WindowsResources `json:"resources,omitempty"`
438440
// CredentialSpec contains a JSON object describing a group Managed Service Account (gMSA) specification.
@@ -447,6 +449,14 @@ type Windows struct {
447449
Network *WindowsNetwork `json:"network,omitempty"`
448450
}
449451

452+
// WindowsDevice represents information about a host device to be mapped into the container.
453+
type WindowsDevice struct {
454+
// Device identifier: interface class GUID, etc.
455+
ID string `json:"id"`
456+
// Device identifier type: "class", etc.
457+
IDType string `json:"idType"`
458+
}
459+
450460
// WindowsResources has container runtime resource constraints for containers running on Windows.
451461
type WindowsResources struct {
452462
// Memory restriction configuration.

0 commit comments

Comments
 (0)