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

Support for Windows job containers #1

Closed
wants to merge 1 commit into from
Closed

Conversation

dcantah
Copy link
Owner

@dcantah dcantah commented Mar 29, 2021

See kubernetes/enhancements#2288 for more background. To avoid any confusion here the name chosen for this container type for the cri API and the user facing k8s settings is HostProcess containers. Internally we've coined these as job containers but it's referring to the same type of container, the cri HostProcess field being set would be our
key to fill in the JobContainer field here on the runtime spec for example.

There's been asks for Windows privileged containers, or something analogous to it, for quite some time. While in the Linux world this can be achieved just be loosening some of the security restrictions normally in place for containers, this isn't as easy on Windows for many reasons. There's no such thing as just mounting in /dev for example.

The model we've landed on to support something akin to privileged containers on Windows is to keep using the container layer technology we currently use for Windows Server and Hyper-V isolated containers, and to simply have the runtime manage a process, or set of processes, in a job object as the container. The work for job containers is open source and lives here:
https://github.com/microsoft/hcsshim/tree/master/internal/jobcontainers

This approach covers all of the use cases we've currently heard that privileged containers would be useful for. Some of these include configuring network settings, administrative tasks, viewing/manipulating storage devices, and the ability to simplify running daemons that need host access (kube-proxy) on Windows. Without these changes we'd likely set an annotation to specify that the runtime should create one of these containers, which isn't ideal.

As for the one optional field, this is really the only thing that actually differs/isn't configurable for normal Windows Server Containers that we would like configurable in this case. With job containers the final writable layer (volume) for the container is mounted on the host so it's accessible and viewable without enumerating the volumes on the host and trying to correlate what volume is the containers. This is different from Windows Server Containers where the volume is never mounted to a directory anywhere, although it's still viewable and accessible from the host (mountvol for example)

Signed-off-by: Daniel Canter [email protected]

@katiewasnothere
Copy link

katiewasnothere commented Mar 29, 2021

This looks like a PR to your own fork, is there a reason for that? Otherwise, LGTM


The following parameters can be specified:

* **`rootfsMountPoint`** *(string, OPTIONAL)* - specifies the path that the containers rootfs volume should be mounted to.

Choose a reason for hiding this comment

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

nit: *container's :)

@@ -557,6 +559,13 @@ type WindowsHyperV struct {
UtilityVMPath string `json:"utilityVMPath,omitempty"`
}

// WindowsJobContainer contains information for configuring a job container on Windows.
type WindowsJobContainer struct {
// RootfsMountPoint is an optional path that indicates where the containers rootfs volume should

Choose a reason for hiding this comment

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

Same with *container's

@dcantah
Copy link
Owner Author

dcantah commented Mar 29, 2021

This looks like a PR to your own fork, is there a reason for that? Otherwise, LGTM

Yea, don't wanna open the PR before our team looks at it

@dcantah
Copy link
Owner Author

dcantah commented Mar 29, 2021

Should probably @ our team also.. hahah. @kevpar @ambarve @anmaxvl

@dcantah
Copy link
Owner Author

dcantah commented Mar 29, 2021

Thanks @katiewasnothere! ❤️

The following parameters can be specified:

* **`rootfsMountPoint`** *(string, OPTIONAL)* - specifies the path that the containers rootfs volume should be mounted to.
If not supplied, the runtime will create a random path for the rootfs to be mounted at.
Copy link

Choose a reason for hiding this comment

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

Rather than random path I would say something like the path will be determined by the runtime.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Good call!

@kevpar
Copy link

kevpar commented Mar 29, 2021

This looks good to me once the current comments are addressed!

@dcantah dcantah force-pushed the windows-job-container branch 2 times, most recently from 12764f4 to 74361f9 Compare March 29, 2021 23:37
See kubernetes/enhancements#2288 for more background.
To avoid any confusion here the name chosen for this container type for
the cri API and the user facing k8s settings is HostProcess containers
Internally we've coined these as job containers but it's referring to the
same type of container, we'd just like to keep the name the same as we use
internally at the OCI level and in our code. The cri HostProcess field
being set would be our key to fill in the WindowsJobContainer field on the
runtime spec for example.

There's been asks for Windows privileged containers, or something analogous
to it, for quite some time. While in the Linux world this can be achieved just
be loosening some of the security restrictions normally in place
for containers, this isn't as easy on Windows for many reasons. There's no such
thing as just mounting in /dev for the easy example.

The model we've landed on to support something akin to privileged containers
on Windows is to keep using the container layer technology we currently use
for Windows Server and Hyper-V isolated containers, and to simply have the
runtime manage a process, or set of processes, in a job object as the container.
The work for job containers is open source and lives here:
https://github.com/microsoft/hcsshim/tree/master/internal/jobcontainers

This approach covers all of the use cases we've currently heard that privileged
containers would be useful for. Some of these include configuring network
settings, administrative tasks, viewing/manipulating storage devices, and
the ability to simplify running daemons that need host access (kube-proxy)
on Windows. Without these changes we'd likely set an annotation to specify
that the runtime should create one of these containers, which isn't ideal.

As for the one optional field, this is really the only thing that actually
differs/isn't configurable for normal Windows Server Containers. With
job containers the final writable layer (volume) for the container
is mounted on the host so it's accessible and viewable without enumerating
the volumes on the host and trying to correlate what volume is the containers.
This is contrary to Windows Server Containers, where the volume is never mounted
to a directory anywhere, although it's still accesible from the host for the
curious.

Signed-off-by: Daniel Canter <[email protected]>
@dcantah dcantah force-pushed the windows-job-container branch from 74361f9 to 3dd1e1f Compare April 6, 2021 19:55
@dcantah dcantah closed this Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants