Skip to content
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 LayerFolders to Windows platform config #828

Merged
merged 1 commit into from
May 30, 2017
Merged

Add LayerFolders to Windows platform config #828

merged 1 commit into from
May 30, 2017

Conversation

sunjayBhatia
Copy link
Contributor

LayerFolders is a property that is missing from the runtime spec that is required for all useful containers on Windows.

This issue mentions extending the runtime spec with "required" platform specific fields.

@wking
Copy link
Contributor

wking commented May 15, 2017 via email

@@ -3,6 +3,21 @@
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.

## <a name="configWindowsLayerFolders" />LayerFolders

**`layerfolders`** (array of strings, REQUIRED) specifies a list of layer folders the container image relies on. The list is ordered from topmost layer to base layer.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be clear, this is something that is not covered by mounts or by image-spec unpacking? These layers need to be assembled by the runtime at container-creation time?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These layers need to be assembled by the runtime at container-creation time?

Yes, this is true. As mentioned in #817 (comment), the underlying subsystem requires that a list of layer paths be passed to the kernel in order to spin up the container. These are not mounts, and I don't believe any functionality like image-spec unpacking is applicable in this case.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For required arrays, you probably also want to require at least one entry (otherwise you might as well make the property OPTIONAL). See #769 for an example of the spec wording and minItems JSON Schema I've used for that sort of thing before.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not my call, but it looks like the variables are all camelCase in here. Should this instead be "layerFolders"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @wking @TomSweeneyRedHat, we made these changes and modified the commit for this PR

@sunjayBhatia
Copy link
Contributor Author

Thanks for the note about PullApprove. We use git-duet to automatically sign our commits when pairing, and it only adds a single sign-off which corresponds to the other pair. That doesn't work with the requirements of PullApprove.

@wking
Copy link
Contributor

wking commented May 15, 2017 via email

@lowenna
Copy link
Contributor

lowenna commented May 15, 2017

@sunjayBhatia Thanks for submitting this - I was just about to add it myself!

(@wking FYI, this is the last of the additions required for Windows - the complete set is #801, #814, #815, #816, #817 and #818)

@sunjayBhatia There's a few issues here which need addressing. The LayerPaths is correct as an array of ordered folders, but it needs to be part of an object at the same level to Resources similar to how it is defined in moby/moby libcontainerd\types_windows.go.

type LayerOption struct {
	// LayerFolderPath is the path to the current layer folder. Empty for Hyper-V containers.
	LayerFolderPath string `json:",omitempty"`
	// Layer paths of the parent layers
	LayerPaths []string
}

It also needs an update to schema\config-windows.json. Let me know if you need any help with this. And thanks again 😸

@sunjayBhatia
Copy link
Contributor Author

@jhowardmsft I'm not sure I agree with including the LayerFolderPath as something that gets included in the runtime spec, mostly because it feels like duplicate info and tying the spec to Docker implementation/hcsshim types/fields feels a little odd.

The "current layer" (sandbox layer in hcsshim parlance) seems to be equivalent to the bundle directory that an OCI compliant CLI (like runc) is given when creating a container. The bundle config.json should specify a Root.Path to the image that containers created from the bundle are based on and the CLI should activate a sandbox layer in the bundle directory since that is where the container's file system lives. When actually creating a Windows Server container from the current layer with hcsshim, we can pass the bundle directory as LayerFolderPath in the hcsshim.ContainerConfig.

With other config options, we have little choice to do anything other than bubble up the hcsshim.ContainerConfig fields up to this spec but I feel like we don't have to do that here.

@sunjayBhatia
Copy link
Contributor Author

Updated schema/config-windows.json to reflect the new field

@tianon
Copy link
Member

tianon commented May 17, 2017

(Taking back my LGTM for now -- @jhowardmsft tells me he's going to review and comment on this one. ❤️)

@sunjayBhatia
Copy link
Contributor Author

@wking any more thoughts on this?

@sunjayBhatia
Copy link
Contributor Author

@jhowardmsft ^

@lowenna
Copy link
Contributor

lowenna commented May 23, 2017

@sunjayBhatia TL;DR LGTM (not a maintainer). I'm good with this change.

However, addressing your comment above, it's slightly more complicated. We actually always need to populate a LayerFolderPath for HCS which needs to be a top-level item. I'll submit a PR for that shortly. And also at the same time, remove the sandbox path which I recently introduced. Between TP5 and RS1, there was a change in HCS such that if SandboxPath is set, it overwrites LayerFolderPath internally, even though LayerFolderPath is set. IOW, SandboxPath is completely redundant in all RTM version of Windows, and LayerFolderPath is required.

As for your comment about Root, there is no Root as such in Hyper-V containers, as the root is really only meaningful inside the Utility VM, not the host itself. In Windows Server Containers, there is a root which is a volume-style path (\\?\Volume{GUID} style) of the containers root file-system which is mounted on the host, and required.

Edit - I'm actually going to add it as SandboxPath as that's a better description than LayerFolderPath

Edit2 - There's no reason to add it. From a spec perspective, it can be in the LayerFolders as the top-most layer. And split by the runtime into the HCS API.

@@ -3,6 +3,22 @@
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.

## <a name="configWindowsLayerFolders" />LayerFolders

**`layerFolders`** (array of strings, REQUIRED) specifies a list of layer folders the container image relies on. The list is ordered from topmost layer to base layer.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the first instance (as far as I know) of a REQUIRED property that is a direct child of a platform property (windows, in this case). Because REQUIRED is only “if the parent is set”, I think you'll want to adjust this section to say that windows MUST be set when platform.os is windows.

Discussion in #830 may end up with platform being removed entirely. If that lands first, it will change the phrasing for the windows requirement, but requiring the windows object for configs aimed at the windows platform will still be something you want.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated config.md to specify that the windows configuration section is required if the windows platform is set. We can update this again if #830 lands before this PR.

Signed-off-by: Matthew Horan <mhoran@pivotal.io>
Signed-off-by: Sunjay Bhatia <sbhatia@pivotal.io>
@@ -328,7 +328,7 @@ Runtime implementations MAY support any valid values for platform-specific field
* **`linux`** (object, OPTIONAL) [Linux-specific configuration](config-linux.md).
This MAY be set if **`platform.os`** is `linux` and MUST NOT be set otherwise.
* **`windows`** (object, OPTIONAL) [Windows-specific configuration](config-windows.md).
This MAY be set if **`platform.os`** is `windows` and MUST NOT be set otherwise.
This MUST be set if **`platform.os`** is `windows` and MUST NOT be set otherwise.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely clear on the maintainers' preference for this (@mrunalp was going to document them), but it's possible that they'll want *Windows changed to Windows in the Go structure now that this property is required on one platform. At least, something like that was the reason given for not wanting pointers for User.UID and User.GID.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats an interesting point. Will it be a little odd that the other platform specific fields are not pointers as well? I would expect the maintainers would like to keep these fields uniform.

@wking wking mentioned this pull request May 24, 2017
@tianon
Copy link
Member

tianon commented May 24, 2017

LGTM

Approved with PullApprove

@vbatts vbatts added this to the 1.0 freeze milestone May 24, 2017
@@ -430,6 +430,8 @@ type SolarisAnet struct {

// Windows defines the runtime configuration for Windows based containers, including Hyper-V containers.
type Windows struct {
// LayerFolders contains a list of absolute paths to directories containing image layers.
LayerFolders []string `json:"layerFolders"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just spotted this. Should be all lower-case for consistency. And the config-windows.json schema file needs the matching update.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be all lower-case for consistency.

There are currently some camelCase entries in config-windows.md. For example, the network properties.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@darrenstahlmsft Could you open a PR to fix ^^

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wking @jhowardmsft i modified the field name as per this suggestion, should I revert it back?

It looks like there are linux fields that use camel case as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like there are linux fields that use camel case as well.

The Linux config tries to consistently use camelCase. I don't know if the maintainers care what convention the Windows-only fields use; probably wait for them to weigh in.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, lets leave this as is. I'll take an action item to clean up the casing once this is merged. Opened #857 to track.

@lowenna
Copy link
Contributor

lowenna commented May 25, 2017

@wking - Are you OK with this now?

@wking
Copy link
Contributor

wking commented May 25, 2017 via email

@lowenna
Copy link
Contributor

lowenna commented May 25, 2017

ping @mrunalp @vbatts @crosbymichael Could one of you review please. Thanks. 👍

@lowenna
Copy link
Contributor

lowenna commented May 25, 2017

I should note this is the last of the structural missing pieces in Windows for 1.0. I have proved now that the docker engine using the current spec plus this PR is fully functional.

@mrunalp
Copy link
Contributor

mrunalp commented May 26, 2017

LGTM

Approved with PullApprove

@TomSweeneyRedHat
Copy link

LGTM

@lowenna
Copy link
Contributor

lowenna commented May 30, 2017

@mrunalp @tianon Can we merge? Has all the right number of "LGTM"s 😄

@tianon tianon merged commit aaa2481 into opencontainers:master May 30, 2017
@lowenna
Copy link
Contributor

lowenna commented May 30, 2017

Thanks @tianon ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants