From 1aff14656b5edf962bea9e164bc6823ad245dbe4 Mon Sep 17 00:00:00 2001 From: John Howard Date: Fri, 16 Sep 2016 13:35:23 -0700 Subject: [PATCH] In progress - adding Windows Signed-off-by: John Howard --- config-windows.md | 80 ++++++++++++++++++++++++++++++++++++++++++++++ config.md | 2 ++ specs-go/config.go | 54 +++++++++++++++++++++++++++++++ 3 files changed, 136 insertions(+) create mode 100644 config-windows.md diff --git a/config-windows.md b/config-windows.md new file mode 100644 index 000000000..668ff93d0 --- /dev/null +++ b/config-windows.md @@ -0,0 +1,80 @@ +# Windows-specific Container Configuration + +This document describes the schema for the [Windows-specific section](config.md#platform-specific-configuration) of the [container configuration](config.md). +The Windows container specification uses APIs provided by the Windows Host Compute Service (HCS) to fulfill the spec. + + +#### Memory + +`memory` is used to set limits on the container's memory usage. + +The following parameters can be specified: + +* **`limit`** *(uint64, optional)* - sets limit of memory usage in bytes + +* **`reservation`** *(uint64, optional)* - sets soft limit of memory usage in bytes + +###### Example + +```json + "memory": { + "limit": 2097152, + "reservation": 524288 + } +``` + +#### CPU + +`cpu` is used to set limits on the container's CPU usage. + +The following parameters can be specified: + +* **`count`** *(uint64, optional)* - specifies the number of CPUs available to the container. + +* **`shares`** *(uint64, optional)* - specifies the relative weight to other containers with CPU shares. The range is from 1 to 10000. + +* **`percent`** *(uint, optional)* - specifies the percentage of available CPUs usable by the container. + +###### Example + +```json + "cpu": { + "percent": 50 + } +``` + +#### Storage + +`storage` is used to set limits on the container's storage usage. + +The following parameters can be specified: + +* **`iops`** *(uint64, optional)* - specifies the maximum Iops for the system drive of the container. + +* **`bps`** *(uint64, optional)* - specifies the maximum bytes per second for the system drive of the container. + +* **`sandboxSize`** *(uint64, optional)* - specifies the size to expand the system drive of the container to if it is currently smaller. + +###### Example + +```json + "storage": { + "iops": 50 + } +``` + +#### Network + +`network` is used to set limits on the container's network usage. + +The following parameters can be specified: + +* **`egressBandwidth`** *(uint64, optional)* - specified the maximum egress bandwidth in bytes per second for the container. + +###### Example + +```json + "network": { + "egressBandwidth": 1048577 + } +``` \ No newline at end of file diff --git a/config.md b/config.md index dfb175f57..6c1e0b662 100644 --- a/config.md +++ b/config.md @@ -256,6 +256,8 @@ For Windows based systems the user structure has the following fields: This SHOULD only be set if **`platform.os`** is `linux`. * **`solaris`** (object, optional) [Solaris-specific configuration](config-solaris.md). This SHOULD only be set if **`platform.os`** is `solaris`. +* **`windows`** (object, optional) [Windows-specific configuration](config-windows.md). + This SHOULD only be set if **`platform.os`** is `windows`. ### Example (Linux) diff --git a/specs-go/config.go b/specs-go/config.go index 685a32863..619f35fad 100644 --- a/specs-go/config.go +++ b/specs-go/config.go @@ -25,6 +25,8 @@ type Spec struct { Linux *Linux `json:"linux,omitempty" platform:"linux"` // Solaris is platform specific configuration for Solaris containers. Solaris *Solaris `json:"solaris,omitempty" platform:"solaris"` + // Windows is platform specific configuration for Windows based containers, including Hyper-V containers. + Windows *Windows `json:"solaris,omitempty" platform:"windows"` } // Process contains information to start a specific application inside the container. @@ -406,6 +408,58 @@ type Anet struct { Macaddress string `json:"macAddress,omitempty"` } +// Windows defines the runtime configuration for Windows based containers, including Hyper-V containers. +type Windows struct { + // Resources contains information for handling resource constraints for the container. + Resources *WindowsResources `json:"resources,omitempty"` +} + +// WindowsResources has container runtime resource constraints for containers running on Windows. +type WindowsResources struct { + // Memory restriction configuration. + Memory *WindowsMemoryResources `json:"memory,omitempty"` + // CPU resource restriction configuration. + CPU *WindowsCPUResources `json:"cpu,omitempty"` + // Storage restriction configuration. + Storage *WindowsStorageResources `json:"storage,omitempty"` + // Network restriction configuration. + Network *WindowsNetworkResources `json:"network,omitempty"` +} + +// WindowsMemoryResources contains memory resource management settings. +type WindowsMemoryResources struct { + // Memory limit in bytes. + Limit *uint64 `json:"limit,omitempty"` + // Memory reservation in bytes. + Reservation *uint64 `json:"reservation,omitempty"` +} + +// WindowsCPUResources contains CPU resource management settings. +type WindowsCPUResources struct { + // Number of CPUs available to the container. + Count *uint64 `json:"count,omitempty"` + // CPU shares (relative weight to other containers with cpu shares). Range is from 1 to 10000. + Shares *uint64 `json:"shares,omitempty"` + // Percent of available CPUs usable by the container. + Percent *uint `json:"percent,omitempty"` +} + +// WindowsStorageResources contains storage resource management settings. +type WindowsStorageResources struct { + // Specifies maximum Iops for the system drive. + Iops *uint64 `json:"iops,omitempty"` + // Specifies maximum bytes per second for the system drive. + Bps *uint64 `json:"bps,omitempty"` + // Sandbox size indicates the size to expand the system drive to if it is currently smaller. + SandboxSize *uint64 `json:"sandboxSize,omitempty"` +} + +// WindowsNetworkResources contains network resource management settings. +type WindowsNetworkResources struct { + // EgressBandwidth is the maximum egress bandwidth in bytes per second. + EgressBandwidth *uint64 `json:"egressBandwidth,omitempty"` +} + // Arch used for additional architectures type Arch string