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

Platform annotations on Process struct #564

Merged
merged 1 commit into from
Sep 20, 2016

Conversation

lowenna
Copy link
Contributor

@lowenna lowenna commented Sep 14, 2016

Signed-off-by: John Howard jhoward@microsoft.com

Extracting pieces from the proof of concept PR for Windows OCI support at #504. This PR tidies up the Process structure by putting annotations for platform support on Capabilities, Rlimits and NoNewPrivileges, none of which are used on Windows. In addition, it removes what appears to be an erroneous blank line that appeared to serve no purpose.

Note I'm assuming (probably incorrectly 😇) , that Rlimits and NoNewPrivileges are also relevant on Solaris too, but I'm not sure. If that is incorrect, I will update the PR to remove the solaris annotation.

@@ -40,13 +40,12 @@ 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"`
// Capabilities are Linux capabilities that are kept for the container.
// Capabilities are Linux capabilities that are kept for the container. (this field is platform dependent)
Capabilities []string `json:"capabilities,omitempty" platform:"linux"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't the platform:"linux" tag already cover the “this field is platform dependent” idea?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Consistency. It's all over this file whenever a platform annotation is present.

// Rlimits specifies rlimit options to apply to the process. (this field is platform dependent)
Rlimits []Rlimit `json:"rlimits,omitempty" platform:"linux,solaris"`
// NoNewPrivileges controls whether additional privileges could be gained by processes in the container. (this field is platform dependent)
NoNewPrivileges bool `json:"noNewPrivileges,omitempty" platform:"linux,solaris"`
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think that these Rlimits or NoNewPrivileges are on Solaris. And we can probably wait for Solaris folks to pipe up if they are, instead of adding them here and waiting for Solaris folks to pipe up to re-remove them ;).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@anuthan - Could you comment on the use (or lack of) of Rlimits and NoNewCapabilities on Solaris? Thanks 😄

Copy link
Contributor

@anuthan anuthan Sep 15, 2016

Choose a reason for hiding this comment

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

Solaris doesn't have Rlimits and NoNewPrivileges . Safe to remove :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@anuthan Thanks for confirming! Removed.

@wking
Copy link
Contributor

wking commented Sep 14, 2016

On Wed, Sep 14, 2016 at 01:51:28PM -0700, John Howard wrote:

  • // Capabilities are Linux capabilities that are kept for the container.
  • // Capabilities are Linux capabilities that are kept for the container. (this field is platform dependent)
    Capabilities []string json:"capabilities,omitempty" platform:"linux"

Consistency. It's all over this file whenever a platform annotation is present.

+1 for consistency. How do folks feel about consistently removing
this from the comment when a platform field exists? And there are
fields like mounts[]options with different rules depending on the
platform, but I expect that folks will recognize that without having a
Go comment here to remind them. Are people really reading the Go
comments and skipping the Markdown spec?

@lowenna
Copy link
Contributor Author

lowenna commented Sep 14, 2016

@wking - Yes, it all does seem more than a tad superfluous IMO. But that said, it's still a little orthogonal to this PR itself 😇

@wking
Copy link
Contributor

wking commented Sep 14, 2016

On Wed, Sep 14, 2016 at 02:44:53PM -0700, John Howard wrote:

@wking - Yes, it all does seem more than a tad superfluous IMO. But
that said, it's still a little orthogonal to this PR itself
😇

This PR does two things (as of 103926f):

a. Add ‘solaris’ to some ‘platform’ tags.
b. Add “(this field is platform dependent)” to some Go comments.

I think we want to drop (a) 1, but am fine waiting on Solaris-dev
feedback there. And I think we want to go the other way with (b).

If this PR is just about (a), I'm happy to file my other-(b) as a
separate PR.

@lowenna
Copy link
Contributor Author

lowenna commented Sep 14, 2016

@wking - Let's try and keep these two things independent, and handle the go comments as a separate issue/PR. I think that will be cleaner in the long run.

@wking
Copy link
Contributor

wking commented Sep 14, 2016

On Wed, Sep 14, 2016 at 04:11:27PM -0700, John Howard wrote:

@wking - Let's try and keep these two things independent, and handle
the go comments as a separate issue/PR. I think that will be cleaner
in the long run.

Sounds good. I spun off the comment removal into #568.

@vbatts
Copy link
Member

vbatts commented Sep 15, 2016

LGTM

Approved with PullApprove

@vbatts
Copy link
Member

vbatts commented Sep 15, 2016

(side note: we ought to define these tags somewhere)

@wking
Copy link
Contributor

wking commented Sep 15, 2016

On Thu, Sep 15, 2016 at 07:28:19AM -0700, Vincent Batts wrote:

LGTM

Really? Solaris does use these fields?

And I agree we should define the tags. We already have the
enum here 1, just need to link it with the JSON tags.

@vbatts
Copy link
Member

vbatts commented Sep 15, 2016

@wking chill.
Solaris supports more of the Linux API than I realize. I'll leave it up to folks like @JLB13 to correct me.

Signed-off-by: John Howard <jhoward@microsoft.com>
@lowenna lowenna force-pushed the jjh/processplatformtags branch from 103926f to ce3ac33 Compare September 15, 2016 17:24
@lowenna
Copy link
Contributor Author

lowenna commented Sep 15, 2016

@vbatts @wking Removed the annotation for solaris

@wking
Copy link
Contributor

wking commented Sep 15, 2016

On Thu, Sep 15, 2016 at 10:25:59AM -0700, John Howard wrote:

@vbatts @wking Removed the annotation for solaris

ce3ac33 looks good to me :).

@hqhq
Copy link
Contributor

hqhq commented Sep 18, 2016

LGTM

Approved with PullApprove

@lowenna
Copy link
Contributor Author

lowenna commented Sep 20, 2016

What's the process for full approval and merging in this repo? There's two LGTMs above, but I'm not sure if more are still required - it appears it does from above, but I'm not sure why. Forgive my ignorance 😇

@hqhq
Copy link
Contributor

hqhq commented Sep 20, 2016

@jhowardmsft We have a .pullapprove.yml which set reset_on_push: true and reviewers: required: 2, so after you force pushed, we still need two LGTMs before merging.

@lowenna
Copy link
Contributor Author

lowenna commented Sep 20, 2016

Ah, I see. Thanks for confirming 😄

@mrunalp
Copy link
Contributor

mrunalp commented Sep 20, 2016

LGTM

Approved with PullApprove

@mrunalp mrunalp merged commit 7bce59f into opencontainers:master Sep 20, 2016
@lowenna lowenna deleted the jjh/processplatformtags branch September 20, 2016 21:53
wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request Sep 27, 2016
Rlimits do not need either ordering or repeat entries for a single
type.  While come JSON libraries preserve object key order or allow
repeats, there are many JSON libraries which do not (e.g. Python and
JavaScript both parse JSON objects into hash tables).  Using objects
here reinforces the unimportance of ordering or repeated entries.

Also add Solaris support.  I'm not entirely clear on this, because
while Solaris is POSIX-certified system and there is a Solaris man
page for setrlimit, Abhijeeth claims no Solaris support for rlimits
[1].

The additionalProperties object bit comes from [2], although it is not
documented in draft 4 of the JSON Schema RFC [3].

[1]: opencontainers#564 (comment)
[2]: https://spacetelescope.github.io/understanding-json-schema/reference/object.html#properties
[3]: https://tools.ietf.org/html/draft-zyp-json-schema-04

Signed-off-by: W. Trevor King <wking@tremily.us>
wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request Sep 27, 2016
Rlimits do not need either ordering or repeat entries for a single
type.  While come JSON libraries preserve object key order or allow
repeats, there are many JSON libraries which do not (e.g. Python and
JavaScript both parse JSON objects into hash tables).  Using objects
here reinforces the unimportance of ordering or repeated entries.

Also add Solaris support.  I'm not entirely clear on this, because
while Solaris is POSIX-certified system and there is a Solaris man
page for setrlimit, Abhijeeth claims no Solaris support for rlimits
[1].

The additionalProperties object bit comes from [2], although it is not
documented in draft 4 of the JSON Schema RFC [3].

[1]: opencontainers#564 (comment)
[2]: https://spacetelescope.github.io/understanding-json-schema/reference/object.html#properties
[3]: https://tools.ietf.org/html/draft-zyp-json-schema-04

Signed-off-by: W. Trevor King <wking@tremily.us>
wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request Oct 27, 2016
Rlimits do not need either ordering or repeat entries for a single
type.  Using an object leans on the new wording from eeaccfa
(glossary: Make objects explicitly unordered and forbid duplicate
names, 2016-09-27, opencontainers#584) to make both of those points explicit.

Also add Solaris support.  I'm not entirely clear on this, because
while Solaris is POSIX-certified system and there is a Solaris man
page for setrlimit, Abhijeeth claims no Solaris support for rlimits
[1].

The additionalProperties object bit comes from [2,3], although it is
not documented in draft 4 of the JSON Schema RFC [4].

[1]: opencontainers#564 (comment)
[2]: https://spacetelescope.github.io/understanding-json-schema/reference/object.html#properties
[3]: https://tools.ietf.org/html/draft-wright-json-schema-validation-00#section-5.18
[4]: https://tools.ietf.org/html/draft-zyp-json-schema-04

Signed-off-by: W. Trevor King <wking@tremily.us>
wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request Nov 3, 2016
Rlimits do not need either ordering or repeat entries for a single
type.  Using an object leans on the new wording from eeaccfa
(glossary: Make objects explicitly unordered and forbid duplicate
names, 2016-09-27, opencontainers#584) to make both of those points explicit.

Also add Solaris support.  I'm not entirely clear on this, because
while Solaris is POSIX-certified system and there is a Solaris man
page for setrlimit, Abhijeeth claims no Solaris support for rlimits
[1].

The additionalProperties object bit comes from [2,3], although it is
not documented in draft 4 of the JSON Schema RFC [4].

[1]: opencontainers#564 (comment)
[2]: https://spacetelescope.github.io/understanding-json-schema/reference/object.html#properties
[3]: https://tools.ietf.org/html/draft-wright-json-schema-validation-00#section-5.18
[4]: https://tools.ietf.org/html/draft-zyp-json-schema-04

Signed-off-by: W. Trevor King <wking@tremily.us>
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.

6 participants