-
Notifications
You must be signed in to change notification settings - Fork 557
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
Add support for Windows based containers #573
Conversation
1aff146
to
c18d87e
Compare
|
||
* **`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. |
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.
Maybe:
specifies the minimum size of the system drive in bytes.
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.
Agreed. Far more succinct. Will be in next push.
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.
Also needs the README bits from #554.
"network": { | ||
"egressBandwidth": 1048577 | ||
} | ||
``` |
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.
Trailing newline.
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.
Fixed in next push.
@@ -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"` |
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.
solaris -> windows.
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.
Embarrassing copy/paste error! Yes, that one is definitely fixed in the upcoming push.
c18d87e
to
7421e1a
Compare
|
||
#### Memory | ||
|
||
`memory` is used to set limits on the container's memory usage. |
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.
The existing spec is not very consistent about this, but I'd like to see an OPTIONAL dropped into this sentence. Maybe:
memory
is an OPTIONAL configuration for the container's memory usage.
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.
No objection at all. Modified memory, CPU, storage, and networking to all match this pattern.
7421e1a
to
73d281d
Compare
type Windows struct { | ||
// Resources contains information for handling resource constraints for the container. | ||
Resources *WindowsResources `json:"resources,omitempty"` | ||
} |
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.
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 resources
note in the Markdown.
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.
Yes, done.
73d281d
to
b12d3a9
Compare
On Sat, Sep 17, 2016 at 09:21:03PM -0700, John Howard wrote:
I think we want all-caps OPTIONAL to trigger the RFC 2119 semantics |
ecae27f
to
1ac354b
Compare
|
||
* **`limit`** *(uint64, optional)* - sets limit of memory usage in bytes | ||
|
||
* **`reservation`** *(uint64, optional)* - sets soft limit of memory usage in bytes |
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.
Linux has resource limits with soft and hard settings:
The soft limit is the value that the kernel enforces for the corresponding resource. The hard limit acts as a ceiling for the soft limit: an unprivileged process may set only its soft limit to a value in the range from 0 up to the hard limit, and (irreversibly) lower its hard limit. A privileged process (under Linux: one with the
CAP_SYS_RESOURCE
capability) may make arbitrary changes to either limit value.
So when you say “soft limit”, that's what I'm thinking. However, “reservation” sounds more like “I need at least this much”. Is this setting a minimum amount required by the container? Or an initial limit on the amount that the container can consume?
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.
Memory management is very different between Linux and Windows. Here, it means a guaranteed minimum amount of memory. I used the existing terminology though. Perhaps incorrectly?
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.
I didn't realize we already had that language, and think it needs to be clarified for the Linux case too. Grepping through runC shows that reservation
is backed by memory.soft_limit_in_bytes
. Kernel docs for that have the following to say about soft limits:
.7. Soft limits
Soft limits allow for greater sharing of memory. The idea behind soft limits
is to allow control groups to use as much of the memory as needed, provideda. There is no memory contention
b. They do not exceed their hard limitWhen the system detects memory contention or low memory, control groups
are pushed back to their soft limits. If the soft limit of each control
group is very high, they are pushed back as much as possible to make
sure that one control group does not starve the others of memory.Please note that soft limits is a best-effort feature; it comes with
no guarantees, but it does its best to make sure that when memory is
heavily contended for, memory is allocated based on the soft limit
hints/setup. Currently soft limit based reclaim is set up such that
it gets invoked frombalance_pgdat
(kswapd
).
So in your case I think reservation
makes a lot of sense for the property name, but you should reroll the description to say something like “guaranteed minimum amount of memory”.
@wking And final update for now - change |
|
||
```json | ||
"windows": { | ||
"resources" { |
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.
Missing a colon.
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.
Fixed (all 4 occurances)
"limit": 2097152, | ||
"reservation": 524288 | ||
} | ||
} |
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.
Looks like an extra level of indents for these two closing braces.
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.
Fixed. Tab rather than 4 spaces. Blame editor 😇
fc3ec5d
to
6e02225
Compare
The Windows container specification uses APIs provided by the Windows Host Compute Service (HCS) to fulfill the spec. | ||
|
||
You can configure a container's resource limits via the `resources` field of the Windows configuration. | ||
Do not specify `resources` unless required. |
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 last line seems overly strict. How about dropping it and using “…the OPTIONAL resources
…” in the preceding line?
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.
And probably worth a ## Resources
before this paragraph so you can link to it specifically after the Windows-specific file grows other types of configurations (which is presumably why you have a resources
level at all ;).
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.
Re wording - I pulled that wording from the Linux spec, or so I thought, so I must have been a little over-keen modifying for the Windows version. So yes, have toned down the verbiage accordingly. Will be in next push.
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.
Updated to include ## Resources
too. Update pushed.
Do not specify `resources` unless required. | ||
|
||
|
||
#### Memory |
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.
With ## Resources
above, this one should be an h3.
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.
Indeed. Have fixed the h1..h4s to be consistent throughout.
This is looking pretty good to me. Still needs a JSON Schema, but it
may be better to wait on that until the Markdown/Go settle down.
|
b476ef3
to
e4bcc04
Compare
Now with JSON schema 😄 |
e4bcc04
to
885047f
Compare
On Mon, Sep 19, 2016 at 01:36:21PM -0700, John Howard wrote:
Looks like you did ;). I've filed #576 to adjust this language on |
}, | ||
"percent": { | ||
"id": "https://opencontainers.org/schema/bundle/windows/resources/cpu/percent", | ||
"$ref": "defs.json#/definitions/uint8Pointer" |
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.
Maybe we want to use defs.json#/definitions/percentPointer
backed by something like:
"percent": {
"type": "integer",
"minimum": 0,
"maximum": 100
},
"percentPointer": {
"oneOf": [
{
"$ref": "#/definitions/percent"
},
{
"type": "null"
}
]
},
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.
Good catch - didn't think of that. 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.
Updated in 40bf0b7
885047f
to
40bf0b7
Compare
|
||
The following parameters can be specified: | ||
|
||
* **`count`** *(uint64, optional)* - specifies the number of CPUs available to the container. |
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.
I'm fine with uint64
here, but am enjoying a mental image of a container that needs 4.3 billion CPUs ;).
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.
Future proofing :)
|
||
* **`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. |
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.
If we know the cap is 10000, we can use a uint16
.
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.
Fixed to cpuShares
type.
"shares": { | ||
"id": "https://opencontainers.org/schema/bundle/windows/resources/cpu/shares", | ||
"$ref": "defs.json#/definitions/uint64Pointer" | ||
}, |
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.json
for 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.
|
||
The following parameters can be specified: | ||
|
||
* **`limit`** *(uint64, optional)* - sets limit of memory usage in bytes. |
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.
Is limit
being over-committed?
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.
Yes. More information on overall memory management of containers on Windows (which is different between Windows Server and Hyper-V containers) will eventually make it into the documentation on microsoft.com, but for now there's nothing published as such.
|
||
* **`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. |
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.
I assume the CPU object is essentially a union across three parameters?
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.
@vishh Well yes, but bearing in mind any or all of them are optional.
40bf0b7
to
d73cf3e
Compare
"cpuSharesPointer": { | ||
"oneOf": [ | ||
{ | ||
"$ref": "#/definitions/CPUShares" |
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.
I don't have much of a preference between cpuShares
and CPUShares
, but we should pick one and stick to it ;).
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.
I'll stick with camelCase. Mea culpa
"cpuShares": { | ||
"description": "Relative weight to other containers with CPU Shares defined", | ||
"type": "integer", | ||
"minimum": 0, |
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.
The Markdown docs say the minimum is 1.
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.
And they're right, this is incorrect. Thanks for catching. Updated in 6c66d16
6c66d16
to
d57e63f
Compare
d57e63f looks good to me :).
|
|
||
* **`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. |
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.
optional -> OPTIONAL
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.
Can you make similar changes throughout this PR?
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.
@mrunalp Yes, of course. Done and pushed.
|
||
The following parameters can be specified: | ||
|
||
* **`iops`** *(uint64, optional)* - specifies the maximum Iops for the system drive of the container. |
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.
Iops --> IO operations or iops?
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.
@mrunalp Updated to IO operations per seconds
.
Signed-off-by: John Howard <[email protected]>
d57e63f
to
dc8f2c2
Compare
@vbatts Would you please give this a look? |
Good stuff. Thanks @jhowardmsft LGTM |
The shift happened in c35cf57 (config: Replace "optional" with "OPTIONAL", 2016-09-17, opencontainers#574) and the 'windows' entry landed in parallel with dc8f2c2 (Add support for Windows-based containers, 2016-09-16, opencontainers#573). Signed-off-by: W. Trevor King <[email protected]>
The shift happened in c35cf57 (config: Replace "optional" with "OPTIONAL", 2016-09-17, opencontainers#574) and the 'windows' entry landed in parallel with dc8f2c2 (Add support for Windows-based containers, 2016-09-16, opencontainers#573). Signed-off-by: W. Trevor King <[email protected]>
Signed-off-by: John Howard [email protected]
This adds Windows support to the OCI runtime-spec: code, JSON schema and markdown documentation. Note that the support has been added using 'aggressive namespacing', the matching changes of which for Linux and Solaris being currently out for review in #567.
This is a formal follow-on the the previous proof-of-concept PR to add support for Windows, #504