-
Notifications
You must be signed in to change notification settings - Fork 553
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 extra file descriptors to Process #100
Conversation
@@ -53,6 +57,8 @@ type Process struct { | |||
// Cwd is the current working directory for the process and must be | |||
// relative to the container's root. | |||
Cwd string `json:"cwd"` | |||
// ExtraFiles specifies open file descriptors that should be passed to the process. | |||
ExtraFiles []*os.File `json:"extraFiles"` |
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 *os.File
really serializing to int?
@mrunalp Why does this need to be in the config though?! Wouldn't they need to be passed through the runtime? |
On Thu, Aug 06, 2015 at 02:18:53PM -0700, Mrunal Patel wrote:
I think Windows uses opaque pointers instead of integer file |
On Thu, Aug 06, 2015 at 02:23:18PM -0700, Brandon Philips wrote:
Presumably you'd write your bundle config with the understanding that |
@philips We can't figure out which fds to pass down in the runtime without them being specified in the config. |
Yup, it's again this host-dependency problem :/ Like we can't expect this FDs to exist on each host. |
@LK4D4 Yes, it is, but I think we can hash that out in the other PR. |
@taylorb-microsoft Could you comment on how this would work on Windows? Thanks! |
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
On Thu, Aug 06, 2015 at 02:32:15PM -0700, Alexander Morozov wrote:
There's no clear line where a container becomes infinitely portable |
@@ -53,6 +57,8 @@ type Process struct { | |||
// Cwd is the current working directory for the process and must be | |||
// relative to the container's root. | |||
Cwd string `json:"cwd"` | |||
// ExtraFiles specifies open file descriptors that should be passed to the process. | |||
ExtraFiles []os.File `json:"extraFiles"` |
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
This might be ExtraFiles []*os.File
json:"extraFiles"``
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.
since this is supposed to be a config that is serialized I highly doubt this will work 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.
@crosbymichael @philips This feature makes more sense as a dynamic property. We could have an environment variable passed to the runtime that could be a list of open fds that it should leak into the container process. For e.g.
sh# OCI_PASS_FDS="3,4" runc 4</path/to/some/file # 3 is passed by systemd
WDYT?
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.
what is your use case?
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.
@crosbymichael Systemd socket activated containers http://0pointer.de/blog/projects/socket-activated-containers.html
We could either make this generic or leave it out and have the runtimes support systemd environment variables for activation.
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 think having runtime support for LISTEN_FDS
and doing passthrough would be better than adding this runtime information in the spec that is to be serialized.
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.
On Fri, Aug 21, 2015 at 11:16:46AM -0700, Michael Crosby wrote:
- // ExtraFiles specifies open file descriptors that should be passed to the process.
- ExtraFiles []os.File
json:"extraFiles"
i think having runtime support for
LISTEN_FDS
and doing
passthrough would be better than adding this runtime information in
the spec that is to be serialized.
You're still serializing those file descriptors into the environment
variable, no? With #88 and the LISTEN_FDS suggestion, that would mean
the runtime would have to check:
- The static config.json
- The more dynamic runtime.json
- The LISTEN_FDS environment variable
to figure out how to create the container and launch the application.
Personally, I see no problem with mutating a single config to launch
the container (so the runtime only has to look in one place) [1,2].
But if we do end up getting a second place to put any configuration
considered “too host-specific for config.json”, then I don't see a
need to go further than a runtime.json.
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 no
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.
On Fri, Aug 21, 2015 at 11:25:04AM -0700, Michael Crosby wrote:
- // ExtraFiles specifies open file descriptors that should be passed to the process.
- ExtraFiles []os.File
json:"extraFiles"
@wking no
Then why not use environment variables for all runtime-specific
settings? If there is a need to use all of:
- config.json
- runtime.json (specs: introduce the concept of a runtime.json #88)
- environment variables
how do we make decisions about sorting between them? E.g. why use
LISTEN_FDS for passing file descriptors through and runtime.json to
pass namespace paths through?
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.
@crosbymichael SGTM
Sorry for the delay, my team is super heads down for the next week or so... The closest proxy in windows to a file descriptor would be a file handle. Which can represent a reference to a file, named pipe, socket, device etc... You generally wouldn't specify a file handle as a configuration parameter, a handle is created by the process using a device descriptor (something like a file name, device object path, IP address etc...) The general expectation I would have as a user though for accessing these types of resources would be to specify them by type so for example if I wanted to connect a named pipe to a container I would expect to provide a config option/flag/ect.... in the form of NamedPipe=.\pipe\foobar not as a generic handle. Hopefully that helps (again apologies that we have not been as active as we'd like to be - looking to address that soon). -Taylor |
@mrunalp Could you make the spec more explicit about how file descriptor passing works in practice between parent and child? Language such as:
The two obvious use cases are attaching stderr/stdout/stdin to a terminal and systemd socket activation so it would be good to call them out explicitly and even provide an example, I think. |
@philips @crosbymichael Opened #113 |
On Fri, Aug 21, 2015 at 11:52:07AM -0700, Mrunal Patel wrote:
#113 took the “don't specify how the runtime knows which FDs to pass” |
Closing this for now, however, we may want to pursue a more limited version that allows passing fds to files specified by paths on the host if there is any demand for such a feature. |
It should be possible to pass file descriptors to the container process to support use cases
like systemd socket activation.
Signed-off-by: Mrunal Patel mrunalp@gmail.com