Skip to content

Commit c18d87e

Browse files
author
John Howard
committed
Add support for Windows-based containers
Signed-off-by: John Howard <[email protected]>
1 parent f0ecb45 commit c18d87e

File tree

3 files changed

+136
-0
lines changed

3 files changed

+136
-0
lines changed

config-windows.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Windows-specific Container Configuration
2+
3+
This document describes the schema for the [Windows-specific section](config.md#platform-specific-configuration) of the [container configuration](config.md).
4+
The Windows container specification uses APIs provided by the Windows Host Compute Service (HCS) to fulfill the spec.
5+
6+
7+
#### Memory
8+
9+
`memory` is used to set limits on the container's memory usage.
10+
11+
The following parameters can be specified:
12+
13+
* **`limit`** *(uint64, optional)* - sets limit of memory usage in bytes
14+
15+
* **`reservation`** *(uint64, optional)* - sets soft limit of memory usage in bytes
16+
17+
###### Example
18+
19+
```json
20+
"memory": {
21+
"limit": 2097152,
22+
"reservation": 524288
23+
}
24+
```
25+
26+
#### CPU
27+
28+
`cpu` is used to set limits on the container's CPU usage.
29+
30+
The following parameters can be specified:
31+
32+
* **`count`** *(uint64, optional)* - specifies the number of CPUs available to the container.
33+
34+
* **`shares`** *(uint64, optional)* - specifies the relative weight to other containers with CPU shares. The range is from 1 to 10000.
35+
36+
* **`percent`** *(uint, optional)* - specifies the percentage of available CPUs usable by the container.
37+
38+
###### Example
39+
40+
```json
41+
"cpu": {
42+
"percent": 50
43+
}
44+
```
45+
46+
#### Storage
47+
48+
`storage` is used to set limits on the container's storage usage.
49+
50+
The following parameters can be specified:
51+
52+
* **`iops`** *(uint64, optional)* - specifies the maximum Iops for the system drive of the container.
53+
54+
* **`bps`** *(uint64, optional)* - specifies the maximum bytes per second for the system drive of the container.
55+
56+
* **`sandboxSize`** *(uint64, optional)* - specifies the size to expand the system drive of the container to if it is currently smaller.
57+
58+
###### Example
59+
60+
```json
61+
"storage": {
62+
"iops": 50
63+
}
64+
```
65+
66+
#### Network
67+
68+
`network` is used to set limits on the container's network usage.
69+
70+
The following parameters can be specified:
71+
72+
* **`egressBandwidth`** *(uint64, optional)* - specified the maximum egress bandwidth in bytes per second for the container.
73+
74+
###### Example
75+
76+
```json
77+
"network": {
78+
"egressBandwidth": 1048577
79+
}
80+
```

config.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,8 @@ For Windows based systems the user structure has the following fields:
256256
This SHOULD only be set if **`platform.os`** is `linux`.
257257
* **`solaris`** (object, optional) [Solaris-specific configuration](config-solaris.md).
258258
This SHOULD only be set if **`platform.os`** is `solaris`.
259+
* **`windows`** (object, optional) [Windows-specific configuration](config-windows.md).
260+
This SHOULD only be set if **`platform.os`** is `windows`.
259261

260262
### Example (Linux)
261263

specs-go/config.go

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ type Spec struct {
2525
Linux *Linux `json:"linux,omitempty" platform:"linux"`
2626
// Solaris is platform specific configuration for Solaris containers.
2727
Solaris *Solaris `json:"solaris,omitempty" platform:"solaris"`
28+
// Windows is platform specific configuration for Windows based containers, including Hyper-V containers.
29+
Windows *Windows `json:"solaris,omitempty" platform:"windows"`
2830
}
2931

3032
// Process contains information to start a specific application inside the container.
@@ -406,6 +408,58 @@ type Anet struct {
406408
Macaddress string `json:"macAddress,omitempty"`
407409
}
408410

411+
// Windows defines the runtime configuration for Windows based containers, including Hyper-V containers.
412+
type Windows struct {
413+
// Resources contains information for handling resource constraints for the container.
414+
Resources *WindowsResources `json:"resources,omitempty"`
415+
}
416+
417+
// WindowsResources has container runtime resource constraints for containers running on Windows.
418+
type WindowsResources struct {
419+
// Memory restriction configuration.
420+
Memory *WindowsMemoryResources `json:"memory,omitempty"`
421+
// CPU resource restriction configuration.
422+
CPU *WindowsCPUResources `json:"cpu,omitempty"`
423+
// Storage restriction configuration.
424+
Storage *WindowsStorageResources `json:"storage,omitempty"`
425+
// Network restriction configuration.
426+
Network *WindowsNetworkResources `json:"network,omitempty"`
427+
}
428+
429+
// WindowsMemoryResources contains memory resource management settings.
430+
type WindowsMemoryResources struct {
431+
// Memory limit in bytes.
432+
Limit *uint64 `json:"limit,omitempty"`
433+
// Memory reservation in bytes.
434+
Reservation *uint64 `json:"reservation,omitempty"`
435+
}
436+
437+
// WindowsCPUResources contains CPU resource management settings.
438+
type WindowsCPUResources struct {
439+
// Number of CPUs available to the container.
440+
Count *uint64 `json:"count,omitempty"`
441+
// CPU shares (relative weight to other containers with cpu shares). Range is from 1 to 10000.
442+
Shares *uint64 `json:"shares,omitempty"`
443+
// Percent of available CPUs usable by the container.
444+
Percent *uint `json:"percent,omitempty"`
445+
}
446+
447+
// WindowsStorageResources contains storage resource management settings.
448+
type WindowsStorageResources struct {
449+
// Specifies maximum Iops for the system drive.
450+
Iops *uint64 `json:"iops,omitempty"`
451+
// Specifies maximum bytes per second for the system drive.
452+
Bps *uint64 `json:"bps,omitempty"`
453+
// Sandbox size indicates the size to expand the system drive to if it is currently smaller.
454+
SandboxSize *uint64 `json:"sandboxSize,omitempty"`
455+
}
456+
457+
// WindowsNetworkResources contains network resource management settings.
458+
type WindowsNetworkResources struct {
459+
// EgressBandwidth is the maximum egress bandwidth in bytes per second.
460+
EgressBandwidth *uint64 `json:"egressBandwidth,omitempty"`
461+
}
462+
409463
// Arch used for additional architectures
410464
type Arch string
411465

0 commit comments

Comments
 (0)