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

Windows: User struct changes #565

Merged
merged 1 commit into from
Sep 15, 2016
Merged

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 modified the User struct by fixing the description, adding a Windows-specific user field, and updating the documentation to include the changes, plus provide a sample JSON in the context of the Process structure.

type User struct {
// UID is the user id. (this field is platform dependent)
UID uint32 `json:"uid" platform:"linux,solaris"`
// GID is the group id. (this field is platform dependent)
GID uint32 `json:"gid" platform:"linux,solaris"`
// AdditionalGids are additional group ids set for the container's process. (this field is platform dependent)
AdditionalGids []uint32 `json:"additionalGids,omitempty" platform:"linux,solaris"`
// User is the user name. (this field is platform dependent)
User string `json:"user,omitempty" platform:"windows"`
Copy link
Contributor

Choose a reason for hiding this comment

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

To avoid User.User, can we call this Username or something? And in that case it could be either Process.User.Username or Process.Username instead of Process.User.User. I like Process.Username best, as long as Windows doesn't plan on needing a more complicated structure in the future (in which case it's probably better to stay under Process.User).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea. I prefer Username. Updated

Unfortunately though, I can't predict the future as well 😸

@lowenna lowenna force-pushed the jjh/user branch 2 times, most recently from 510e5de to 08cf7d4 Compare September 14, 2016 21:32
"cwd": "c:\\foo",
"args": [
"someapp.exe"],
],
Copy link
Contributor

Choose a reason for hiding this comment

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

Drop the trailing comma?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@jhowardmsft I think you may have duplicate instances of "]," on lines 212 and 213.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. That's what I get for copy/pasting from the Solaris example immediately above it. Fixed both 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@RobDolinMS Yes, fixed.

Signed-off-by: John Howard <jhoward@microsoft.com>
@tianon
Copy link
Member

tianon commented Sep 15, 2016

LGTM

Approved with PullApprove

1 similar comment
@vbatts
Copy link
Member

vbatts commented Sep 15, 2016

LGTM

Approved with PullApprove

@vbatts vbatts merged commit a992b1b into opencontainers:master Sep 15, 2016
wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request Sep 15, 2016
We dropped these in 4774080 (specs-go/config: Drop "this field is
platform dependent", 2016-09-14, opencontainers#568) but f9e48e0 (Windows: User
struct changes, 2016-09-14, opencontainers#565) was developed in parallel and
brought in a new one.

Signed-off-by: W. Trevor King <wking@tremily.us>
@lowenna lowenna deleted the jjh/user branch September 15, 2016 16:44
wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request Apr 7, 2017
On POSIX (currently Linux and Solaris), `uid` and `gid` are
required. My preferred approach here is to make those optional and use
platform 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].

The Windows `username`, on the other hand, was optional, although the
default behavior is unclear.  I see no discussion in f9e48e0
(Windows: User struct changes, 2016-09-14, opencontainers#565) or its pull-request
discussion to suggest whether this was intentionally approved or not.
When I asked whether the optional-ness was intentional, Michael said
[6]:

  No, both should be made explicit unless there is something on
  windows that prohibits this.

So this commit is making that happen.

[1]: https://groups.google.com/a/opencontainers.org/forum/#!topic/dev/DWdystx5X3A
[2]: opencontainers#417 (comment)
     Subject: Exposing platform defaults
     Date: Thu, 14 Jan 2016 15:36:26 -0800
     Message-ID: <20160114233625.GN6362@odin.tremily.us>
[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)

Signed-off-by: W. Trevor King <wking@tremily.us>
wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request Apr 24, 2017
On POSIX (currently Linux and Solaris), `uid` and `gid` are
required. My preferred approach here is to make those optional and use
platform 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].

The Windows `username`, on the other hand, was optional, although the
default behavior is unclear.  I see no discussion in f9e48e0
(Windows: User struct changes, 2016-09-14, opencontainers#565) or its pull-request
discussion to suggest whether this was intentionally approved or not.
When I asked whether the optional-ness was intentional, Michael said
[6]:

  No, both should be made explicit unless there is something on
  windows that prohibits this.

However, when I filed a pull request to make the property required,
John pushed back [7] and prefered implementation-defined default
behavior.  I'm still not clear if that satisfies Michael's "prohibits"
condition, but having optional user values is closer to my personal
preference than requiring the property, and John seems to be fairly
strongly against requiring the property, so this commit documents the
default value to make the OPTIONAL-ness useful.

I've also added the property to the JSON Schema for validation.  The
empty-string bit follows wording from 'annotations', and avoids
ambiguity with the non-pointer Go property.  I doubt empty-string
usernames would work, and having the restriction in the spec allows
for us to validate this in runtime-tools (vs. passing validation and
then failing to launch a container when the runtime chokes on the
empty string).

[1]: https://groups.google.com/a/opencontainers.org/forum/#!topic/dev/DWdystx5X3A
[2]: opencontainers#417 (comment)
     Subject: Exposing platform defaults
     Date: Thu, 14 Jan 2016 15:36:26 -0800
     Message-ID: <20160114233625.GN6362@odin.tremily.us>
[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#760 (comment)
[8]: opencontainers#760 (comment)

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.

5 participants