-
Notifications
You must be signed in to change notification settings - Fork 593
Add support for Windows based containers #573
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+271
−0
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| # 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. | ||
|
|
||
| ## Resources | ||
|
|
||
| You can configure a container's resource limits via the OPTIONAL `resources` field of the Windows configuration. | ||
|
|
||
| ### Memory | ||
|
|
||
| `memory` is an OPTIONAL configuration for 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 the guaranteed minimum amount of memory for a container in bytes. | ||
|
|
||
| #### Example | ||
|
|
||
| ```json | ||
| "windows": { | ||
| "resources": { | ||
| "memory": { | ||
| "limit": 2097152, | ||
| "reservation": 524288 | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### CPU | ||
|
|
||
| `cpu` is an OPTIONAL configuration for the container's CPU usage. | ||
|
|
||
| The following parameters can be specified: | ||
|
|
||
| * **`count`** *(uint64, OPTIONAL)* - specifies the number of CPUs available to the container. | ||
|
|
||
| * **`shares`** *(uint16, 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 | ||
| "windows": { | ||
| "resources": { | ||
| "cpu": { | ||
| "percent": 50 | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### Storage | ||
|
|
||
| `storage` is an OPTIONAL configuration for the container's storage usage. | ||
|
|
||
| The following parameters can be specified: | ||
|
|
||
| * **`iops`** *(uint64, OPTIONAL)* - specifies the maximum IO operations per second 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 minimum size of the system drive in bytes. | ||
|
|
||
| #### Example | ||
|
|
||
| ```json | ||
| "windows": { | ||
| "resources": { | ||
| "storage": { | ||
| "iops": 50 | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### Network | ||
|
|
||
| `network` is an OPTIONAL configuration for 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 | ||
| "windows": { | ||
| "resources": { | ||
| "network": { | ||
| "egressBandwidth": 1048577 | ||
| } | ||
| } | ||
| } | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| { | ||
| "windows": { | ||
| "description": "Windows platform-specific configurations", | ||
| "id": "https://opencontainers.org/schema/bundle/windows", | ||
| "type": "object", | ||
| "properties": { | ||
| "resources": { | ||
| "id": "https://opencontainers.org/schema/bundle/windows/resources", | ||
| "type": "object", | ||
| "properties": { | ||
| "memory": { | ||
| "id": "https://opencontainers.org/schema/bundle/windows/resources/memory", | ||
| "type": "object", | ||
| "properties": { | ||
| "limit": { | ||
| "id": "https://opencontainers.org/schema/bundle/windows/resources/memory/limit", | ||
| "$ref": "defs.json#/definitions/uint64Pointer" | ||
| }, | ||
| "reservation": { | ||
| "id": "https://opencontainers.org/schema/bundle/windows/resources/memory/reservation", | ||
| "$ref": "defs.json#/definitions/uint64Pointer" | ||
| } | ||
| } | ||
| }, | ||
| "cpu": { | ||
| "id": "https://opencontainers.org/schema/bundle/windows/resources/cpu", | ||
| "type": "object", | ||
| "properties": { | ||
| "count": { | ||
| "id": "https://opencontainers.org/schema/bundle/windows/resources/cpu/count", | ||
| "$ref": "defs.json#/definitions/uint64Pointer" | ||
| }, | ||
| "shares": { | ||
| "id": "https://opencontainers.org/schema/bundle/windows/resources/cpu/shares", | ||
| "$ref": "defs-windows.json#/definitions/cpuSharesPointer" | ||
| }, | ||
| "percent": { | ||
| "id": "https://opencontainers.org/schema/bundle/windows/resources/cpu/percent", | ||
| "$ref": "defs.json#/definitions/percentPointer" | ||
| } | ||
| } | ||
| }, | ||
| "storage": { | ||
| "id": "https://opencontainers.org/schema/bundle/windows/resources/storage", | ||
| "type": "object", | ||
| "properties": { | ||
| "iops": { | ||
| "id": "https://opencontainers.org/schema/bundle/windows/resources/storage/iops", | ||
| "$ref": "defs.json#/definitions/uint64Pointer" | ||
| }, | ||
| "bps": { | ||
| "id": "https://opencontainers.org/schema/bundle/windows/resources/storage/bps", | ||
| "$ref": "defs.json#/definitions/uint64Pointer" | ||
| }, | ||
| "sandboxSize": { | ||
| "id": "https://opencontainers.org/schema/bundle/windows/resources/storage/sandboxSize", | ||
| "$ref": "defs.json#/definitions/uint64Pointer" | ||
| } | ||
| } | ||
| }, | ||
| "network": { | ||
| "id": "https://opencontainers.org/schema/bundle/windows/resources/network", | ||
| "type": "object", | ||
| "properties": { | ||
| "egressBandwidth": { | ||
| "id": "https://opencontainers.org/schema/bundle/windows/resources/network/egressBandwidth", | ||
| "$ref": "defs.json#/definitions/uint64Pointer" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| { | ||
| "definitions": { | ||
| "cpuShares": { | ||
| "description": "Relative weight to other containers with CPU Shares defined", | ||
| "type": "integer", | ||
| "minimum": 1, | ||
| "maximum": 10000 | ||
| }, | ||
| "cpuSharesPointer": { | ||
| "oneOf": [ | ||
| { | ||
| "$ref": "#/definitions/cpuShares" | ||
| }, | ||
| { | ||
| "type": "null" | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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:"windows,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"` | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You don't seem to define this in the Markdown. If you really want: {
…
"windows": {
"resources": {
"memory": {…}
}
}
}instead of: {
…
"windows": {
"memory": {…}
}
}You should drop a
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, done. |
||
|
|
||
| // 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 *uint16 `json:"shares,omitempty"` | ||
| // Percent of available CPUs usable by the container. | ||
| Percent *uint8 `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 specifies the minimum size of the system drive in bytes. | ||
| 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 | ||
|
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably needs
defs-windows.jsonfor CPUShares so we can check the 1–10k range.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, will update.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wking - Updated in d73cf3e