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

config: Make process optional #701

Merged
merged 1 commit into from
May 10, 2017

Conversation

wking
Copy link
Contributor

@wking wking commented Feb 27, 2017

Since #384, it's possible for a container process to never execute user-specified code (e.g. you can call create, kill, delete without calling start). For folks who expect to do that, there's no reason to define process.args.

The narrow solution to this would be to make process.args optional, but that approach was rejected in favor of this all-or-nothing approach to process handling. What an unset process means for the implementation-defined container process between create and start is unclear, but clarifying how that is handled is a separate issue (#700) independent of whether process is optional or not.

Since be59415 (Split create and start, 2016-04-01, opencontainers#384), it's
possible for a container process to never execute user-specified code
(e.g. you can call 'create', 'kill', 'delete' without calling
'start').  For folks who expect to do that, there's no reason to
define process.args.

The only other process property required for all platforms is 'cwd',
but the runtime's idler code isn't specified in sufficient detail for
the configuration author to have an opinion about what its working
directory should be.

On Linux and Solaris, 'user' is also required for 'uid' and 'gid'.  My
preferred approach here is to make those optional and define defaults
[1,2]:

  If unset, the runtime will not attempt to manipulate the user ID
  (e.g. not calling setuid(2) or similar).

But the maintainer consensus is that they want those to be explicitly
required properties [3,4,5].  With the current spec, one option could
be to make process optional (with the idler's working directory
unspecified) for OSes besides Linux and Solaris.  On Windows, username
is optional, but that was likely accidental [6].

So an unspecified 'process' would leave process.cwd and process.user
unset.  What that means for the implementation-defined container
process between 'create' and 'start' is unclear, but clarifying how
that is handled is a separate issue [7] independent of whether
'process' is optional or not.

[1]: opencontainers#417 (comment)
[2]: https://groups.google.com/a/opencontainers.org/forum/#!topic/dev/DWdystx5X3A
     Subject: Exposing platform defaults
     Date: Thu, 14 Jan 2016 15:36:26 -0800
     Message-ID: <[email protected]>
[3]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2016/opencontainers.2016-05-04-17.00.log.html#l-44
[4]: opencontainers#417 (comment)
[5]: opencontainers#417 (comment)
[6]: opencontainers#618 (comment)
[7]: opencontainers#700

Signed-off-by: W. Trevor King <[email protected]>
@cyphar
Copy link
Member

cyphar commented Feb 27, 2017

I would like it if we had some language in create that states that process.args should only be "checked" when you hit start. create should allow for the process to block, waiting to execute a program that doesn't exist.

runC doesn't do this now, but I would like some language to make it clear that this is meant to be a supported workflow.

@wking
Copy link
Contributor Author

wking commented Feb 27, 2017 via email

@mrunalp
Copy link
Contributor

mrunalp commented May 10, 2017

LGTM

Approved with PullApprove

1 similar comment
@crosbymichael
Copy link
Member

crosbymichael commented May 10, 2017

LGTM

Approved with PullApprove

@crosbymichael crosbymichael merged commit 57a5876 into opencontainers:master May 10, 2017
@wking wking deleted the optional-process branch May 10, 2017 23:51
wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request May 11, 2017
It's optional since c41ea83 (config: Make process optional,
2017-02-27, opencontainers#701) which landed yesterday.

Signed-off-by: W. Trevor King <[email protected]>
wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request May 11, 2017
It's optional since c41ea83 (config: Make process optional,
2017-02-27, opencontainers#701) which landed yesterday.

Mrunal wanted to continue testing a config which has enough for a
'start' invocation [1], so I've kept the old JSON as
minimal-for-start.json (washing it through 'make -C schema fmt' to
adjust the args indenting).

[1]: opencontainers#805 (comment)

Signed-off-by: W. Trevor King <[email protected]>
@vbatts vbatts mentioned this pull request Jul 5, 2017
wking added a commit to wking/cri-o that referenced this pull request Jan 19, 2018
OCI runtime callers (like CRI-O) are allowed to leave process unset
[1] for containers that they do not intend to 'start'.  When we don't
have any process.args, we *must* leave process unset (because
process.args is required [2]).  My personal preference would have been
to have both process and process.args optional [3], which would have
allowed for these settings to be decoupled, but that's not where the
spec ended up.

When we have no args and are clearing Process, we need to ensure that
we don't re-create an args-less structure later on by populating
process.user or similar.  This commit collects later process-creating
calls (e.g. setupContainerUser, which populates process.user) into the
"we have some args" branch.

This commit leaves earlier process-creating calls
(e.g. SetProcessTerminal) where they were.  Anything they do inside
Process will be clobbered later if we nil it, but that's fine.

[1]: https://github.com/opencontainers/runtime-spec/blame/v1.0.1/config.md#L145
[2]: https://github.com/opencontainers/runtime-spec/blame/v1.0.1/config.md#L157
[3]: opencontainers/runtime-spec#701 (comment)

Signed-off-by: W. Trevor King <[email protected]>
wking added a commit to wking/cri-o that referenced this pull request Jan 19, 2018
OCI runtime callers (like CRI-O) are allowed to leave process unset
[1] for containers that they do not intend to 'start'.  When we don't
have any process.args, we *must* leave process unset (because
process.args is required [2]).  My personal preference would have been
to have both process and process.args optional [3], which would have
allowed for these settings to be decoupled, but that's not where the
spec ended up.

When we have no args and are clearing Process, we need to ensure that
we don't re-create an args-less structure later on by populating
process.user or similar.  This commit collects later process-creating
calls (e.g. setupContainerUser, which populates process.user) into the
"we have some args" branch.

This commit leaves earlier process-creating calls
(e.g. SetProcessTerminal) where they were.  Anything they do inside
Process will be clobbered later if we nil it, but that's fine.

[1]: https://github.com/opencontainers/runtime-spec/blame/v1.0.1/config.md#L145
[2]: https://github.com/opencontainers/runtime-spec/blame/v1.0.1/config.md#L157
[3]: opencontainers/runtime-spec#701 (comment)

Signed-off-by: W. Trevor King <[email protected]>
wking added a commit to wking/cri-o that referenced this pull request Jan 19, 2018
OCI runtime callers (like CRI-O) are allowed to leave process unset
[1] for containers that they do not intend to 'start'.  When we don't
have any process.args, we *must* leave process unset (because
process.args is required [2]).  My personal preference would have been
to have both process and process.args optional [3], which would have
allowed for these settings to be decoupled, but that's not where the
spec ended up.

When we have no args and are clearing Process, we need to ensure that
we don't re-create an args-less structure later on by populating
process.user or similar.  This commit collects later process-creating
calls (e.g. setupContainerUser, which populates process.user) into the
"we have some args" branch.

This commit leaves earlier process-creating calls
(e.g. SetProcessTerminal) where they were.  Anything they do inside
Process will be clobbered later if we nil it, but that's fine.

[1]: https://github.com/opencontainers/runtime-spec/blame/v1.0.1/config.md#L145
[2]: https://github.com/opencontainers/runtime-spec/blame/v1.0.1/config.md#L157
[3]: opencontainers/runtime-spec#701 (comment)

Signed-off-by: W. Trevor King <[email protected]>
wking added a commit to wking/cri-o that referenced this pull request Jan 24, 2018
OCI runtime callers (like CRI-O) are allowed to leave process unset
[1] for containers that they do not intend to 'start'.  When we don't
have any process.args, we *must* leave process unset (because
process.args is required [2]).  My personal preference would have been
to have both process and process.args optional [3], which would have
allowed for these settings to be decoupled, but that's not where the
spec ended up.

When we have no args and are clearing Process, we need to ensure that
we don't re-create an args-less structure later on by populating
process.user or similar.  This commit collects later process-creating
calls (e.g. setupContainerUser, which populates process.user) into the
"we have some args" branch.

This commit leaves earlier process-creating calls
(e.g. SetProcessTerminal) where they were.  Anything they do inside
Process will be clobbered later if we nil it, but that's fine.

[1]: https://github.com/opencontainers/runtime-spec/blame/v1.0.1/config.md#L145
[2]: https://github.com/opencontainers/runtime-spec/blame/v1.0.1/config.md#L157
[3]: opencontainers/runtime-spec#701 (comment)

Signed-off-by: W. Trevor King <[email protected]>
wking added a commit to wking/runc that referenced this pull request Feb 20, 2018
As it can be since opencontainers/runtime-spec@c41ea83d (config: Make
process optional, 2017-02-27, opencontainers/runtime-spec#701).

Signed-off-by: W. Trevor King <[email protected]>
wking added a commit to wking/runc that referenced this pull request Feb 20, 2018
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.

4 participants