Skip to content

Commit

Permalink
Merge pull request #976 from cwilhit/master
Browse files Browse the repository at this point in the history
config: Add Windows Devices to Schema
  • Loading branch information
vbatts authored Jul 10, 2018
2 parents 34fd552 + 65fac2b commit d810dbc
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 0 deletions.
28 changes: 28 additions & 0 deletions config-windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,34 @@ The Windows container specification uses APIs provided by the Windows Host Compu
}
```

## <a name="configWindowsDevices" />Devices

**`devices`** (array of objects, OPTIONAL) lists devices that MUST be available in the container.

Each entry has the following structure:

* **`id`** *(string, REQUIRED)* - specifies the device which the runtime MUST make available in the container.
* **`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].

[interfaceGUID]: https://docs.microsoft.com/en-us/windows-hardware/drivers/install/overview-of-device-interface-classes

### Example

```json
"windows": {
"devices": [
{
"id": "24E552D7-6523-47F7-A647-D3465BF1F5CA",
"idType": "class"
},
{
"id": "5175d334-c371-4806-b3ba-71fd53c9258d",
"idType": "class"
}
]
}
```

## <a name="configWindowsResources" />Resources

You can configure a container's resource limits via the OPTIONAL `resources` field of the Windows configuration.
Expand Down
1 change: 1 addition & 0 deletions schema/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ The layout of the files is as follows:
* [state-schema.json](state-schema.json) - the primary entrypoint for the [state JSON](../runtime.md#state) schema
* [defs.json](defs.json) - definitions for general types
* [defs-linux.json](defs-linux.json) - definitions for Linux-specific types
* [defs-windows.json](defs-windows.json) - definitions for Windows-specific types
* [validate.go](validate.go) - validation utility source code


Expand Down
6 changes: 6 additions & 0 deletions schema/config-windows.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
},
"minItems": 1
},
"devices": {
"type": "array",
"items": {
"$ref": "defs-windows.json#/definitions/Device"
}
},
"resources": {
"type": "object",
"properties": {
Expand Down
22 changes: 22 additions & 0 deletions schema/defs-windows.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"definitions": {
"Device": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"idType": {
"type": "string",
"enum": [
"class"
]
}
},
"required": [
"id",
"idType"
]
}
}
}
10 changes: 10 additions & 0 deletions specs-go/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,8 @@ type SolarisAnet struct {
type Windows struct {
// LayerFolders contains a list of absolute paths to directories containing image layers.
LayerFolders []string `json:"layerFolders"`
// Devices are the list of devices to be mapped into the container.
Devices []WindowsDevice `json:"devices,omitempty"`
// Resources contains information for handling resource constraints for the container.
Resources *WindowsResources `json:"resources,omitempty"`
// CredentialSpec contains a JSON object describing a group Managed Service Account (gMSA) specification.
Expand All @@ -447,6 +449,14 @@ type Windows struct {
Network *WindowsNetwork `json:"network,omitempty"`
}

// WindowsDevice represents information about a host device to be mapped into the container.
type WindowsDevice struct {
// Device identifier: interface class GUID, etc.
ID string `json:"id"`
// Device identifier type: "class", etc.
IDType string `json:"idType"`
}

// WindowsResources has container runtime resource constraints for containers running on Windows.
type WindowsResources struct {
// Memory restriction configuration.
Expand Down

0 comments on commit d810dbc

Please sign in to comment.