-
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
config: Add consoleSize to process #563
Conversation
@@ -118,6 +118,10 @@ For more information about SELinux, see [Selinux documentation](http://selinuxp | |||
* **`noNewPrivileges`** (bool, optional) setting `noNewPrivileges` to true prevents the processes in the container from gaining additional privileges. | |||
[The kernel doc](https://www.kernel.org/doc/Documentation/prctl/no_new_privs.txt) has more information on how this is achieved using a prctl system call. | |||
|
|||
For Windows-based systems, the process structure supports the following process specific fields: | |||
|
|||
* **`initialconsolesize`** (array of ints, optional) specifies the initial console size (height, width) of the terminal if attached. |
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.
capitalization is significant
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.
Yes, I deliberately did this as the capitalisation is consistent with other items such as rlimits (vs rLimits
). Are those incorrect as well? If so, I'll open another PR to address that, but fix the capitalisation to initialConsoleSize
here.
On Wed, Sep 14, 2016 at 01:38:46PM -0700, John Howard wrote:
Touche ;). I'm fine with rlimits, rLimits, and resourceLimits. And |
be80d0d
to
47a03c6
Compare
Updated it to camelCase. Given there's almost no |
@@ -51,6 +51,8 @@ type Process struct { | |||
ApparmorProfile string `json:"apparmorProfile,omitempty" platform:"linux"` | |||
// SelinuxLabel specifies the selinux context that the container process is run as. (this field is platform dependent) | |||
SelinuxLabel string `json:"selinuxLabel,omitempty" platform:"linux"` | |||
// InitialConsoleSize contains the initial h,w of the console size. (this field is platform dependent) | |||
InitialConsoleSize [2]int `json:"initialConsoleSize" platform:"windows"` |
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.
uint
? ;)
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.
Yup. Good catch. Updating - pushing shortly.
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.
Done. And the matching doc change ;)
@@ -51,6 +51,8 @@ type Process struct { | |||
ApparmorProfile string `json:"apparmorProfile,omitempty" platform:"linux"` | |||
// SelinuxLabel specifies the selinux context that the container process is run as. (this field is platform dependent) | |||
SelinuxLabel string `json:"selinuxLabel,omitempty" platform:"linux"` | |||
// InitialConsoleSize contains the initial h,w of the console size. (this field is platform dependent) |
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.
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.
Yes, of course :)
47a03c6
to
c86f32c
Compare
c86f32c looks good to me, although “of the console size” could
probably be trimmed to “of the console” ;).
|
LGTM |
c86f32c
to
2a7b7c6
Compare
Grammer police 🚔 😄 @wking - Fixed, thanks for catching. |
@@ -118,6 +118,10 @@ For more information about SELinux, see [Selinux documentation](http://selinuxp | |||
* **`noNewPrivileges`** (bool, optional) setting `noNewPrivileges` to true prevents the processes in the container from gaining additional privileges. | |||
[The kernel doc](https://www.kernel.org/doc/Documentation/prctl/no_new_privs.txt) has more information on how this is achieved using a prctl system call. | |||
|
|||
For Windows-based systems, the process structure supports the following process specific fields: | |||
|
|||
* **`initialConsoleSize`** (array of uints, optional) specifies the initial console size (height, width) of the terminal if attached. |
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.
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.
The ordering here is consistent with the way the platform API is implemented.
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.
👍 thanks for confirming ❤️
@@ -118,6 +118,10 @@ For more information about SELinux, see [Selinux documentation](http://selinuxp | |||
* **`noNewPrivileges`** (bool, optional) setting `noNewPrivileges` to true prevents the processes in the container from gaining additional privileges. | |||
[The kernel doc](https://www.kernel.org/doc/Documentation/prctl/no_new_privs.txt) has more information on how this is achieved using a prctl system call. | |||
|
|||
For Windows-based systems, the process structure supports the following process specific fields: |
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 it is also needed in the linux.
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.
@laijs Why do you think that? It's needed on Windows to init the conhost terminal, but it's only ever been in Windows to date.
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.
In linux, we also use a default winsize for the tty console when starting the container, and then we resize it later, these is a gap between them.
2a7b7c6
to
0fa739c
Compare
Updated to not make this a Windows-specific field after comment https://github.com/opencontainers/runtime-spec/pull/563/files#r79284892 from @laijs |
0fa739c
to
dcf55f5
Compare
@@ -31,6 +31,8 @@ type Spec struct { | |||
type Process struct { | |||
// Terminal creates an interactive terminal for the container. | |||
Terminal bool `json:"terminal,omitempty"` | |||
// InitialConsoleSize contains the initial h,w of the console. | |||
InitialConsoleSize [2]uint `json:"initialConsoleSize"` |
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.
Hello, @maintainers, how about use a more verbose structure here?
type ConsoleWindowSize struct {
Height uint `json:"height"`
Width uint `json:"width"`
}
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.
+1 for explicit height/width. Although probably no need for the specific name. type Box
would give us something we could use in other places, although I can't think of other consumers now.
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.
+1 for this change, @jhowardmsft 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.
Agreed. Updated using Box
, and updated the docs accordingly
dcf55f5
to
0efe3b8
Compare
@@ -95,6 +95,7 @@ See links for details about [mountvol](http://ss64.com/nt/mountvol.html) and [Se | |||
**`process`** (object, required) configures the container process. | |||
|
|||
* **`terminal`** (bool, optional) specifies whether you want a terminal attached to that process, defaults to false. | |||
* **`initialConsoleSize`** (box, optional) specifies the initial console size of the terminal if attached. |
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 prefer naming as consoleWindowSize
as @laijs suggested, because we might want to update process console size and it seems weird to assign new config to the field with initial
prefixed.
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.
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.
Yes Linux has tty console size, but the Window
in the name consoleWindowSize
doesn't mean Windows operate system
, it just reflect semantics from http://man7.org/linux/man-pages/man4/tty_ioctl.4.html (section Get and set window size
).
And I don't think we need to specify initial
for the usage of initialization, otherwise we'll call InitialArgs
, InitialRlimits
, etc.. Not to mention that they can also be used in non-initialization stages.
On Sat, Sep 17, 2016 at 11:24:02PM -0700, Qiang Huang wrote:
I'm fine dropping initial, but thought I'd point out that the current |
@wking Yeah I plan to put this back on table post-1.0, but we'll support it in runc whether it's in spec or not, so we better keep it looks reasonable for update. |
Are there not already many fields which are not configurable post create? I don't care though, if consensus is to remove 'initial', so be it. Imo it seems pretty descriptive of the purpose though. |
On Sun, Sep 18, 2016 at 12:34:59AM -0700, John Howard wrote:
It may be helpful to think about this in three classes: a. Initial setup. The resource (e.g. a console) was just created and It's probably good to remind users that most settings are not set in
|
@wking. Thanks. The current commit f2bc43b should reflect the changes based on all feedback to date. I would be inclined to say that adding something like opencontainers/image-spec#311 belongs in a separate PR rather than polluting this one. I'm happy to put that together later today. |
On Mon, Sep 19, 2016 at 11:02:46AM -0700, John Howard wrote:
That's fine with me. Leaving the consoleSize-unset behavior implicit f2bc43b looks good to me, except the commit summary should now be: config: Add consoleSize to process |
f2bc43b
to
55956b8
Compare
Ah yes, of course. Commit summary and PR title updated. |
55956b8 and a punt on porting opencontainers/image-spec#311 looks
good to me.
|
@tianon - sorry, it's gone through a few revisions since your last LGTMs. Any chance of a further review? Thanks ❤️ |
On Tue, Sep 20, 2016 at 02:27:34PM -0700, Tianon Gravi wrote:
#574 is probably causing a lot of trivial conflicts. |
55956b8
to
f31b19f
Compare
Rebased. Yes, it was #574 (optional --> OPTIONAL) |
@@ -95,6 +95,7 @@ See links for details about [mountvol](http://ss64.com/nt/mountvol.html) and [Se | |||
**`process`** (object, REQUIRED) configures the container process. | |||
|
|||
* **`terminal`** (bool, OPTIONAL) specifies whether you want a terminal attached to that process, defaults to false. | |||
* **`consoleSize`** (box, OPTIONAL) specifies the console size of the terminal if attached. |
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.
It's pretty clear from the Go and JSON Schema what “box” means here. But it's the Markdown that's normative. I'd recommend either inlining the defintion here:
consoleSize
(object, OPTIONAL) specifies the console size of the terminal if attached.
Contains the following properties:
height
(uint, REQUIRED) specifies the height of the console.width
(uint, REQUIRED) specifies the width of the console.
Or defining box
in a separate section at the end of this file:
Box
A geometric box.
This object has the following fields:
height
…
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.
Updated using the first notation from your suggestions. (a502caf)
Signed-off-by: John Howard <jhoward@microsoft.com>
f31b19f
to
a502caf
Compare
a502caf looks good to me (like most of the previous iterations of this
PR ;).
|
1 similar comment
…r unset The old language is from a502caf (config: Add consoleSize to process, 2016-09-14, opencontainers#563), where nobody commented on the "if attached" wording [1]. But reading the old line now, it's not clear to me what consoleSize means when terminal is not true. This commit explicitly declares consoleSize unspecified in that condition, so runtimes are free to do what they want short of erroring out. I considered making the property undefined or requiring it to be unset, but those seemed too strict given our permissive "MUST ignore unknown properties" extensibility requirement. [1]: opencontainers#563 Signed-off-by: W. Trevor King <wking@tremily.us>
…r unset The old language is from a502caf (config: Add consoleSize to process, 2016-09-14, opencontainers#563), where nobody commented on the "if attached" wording [1]. But reading the old line now, it's not clear to me what consoleSize means when terminal is not true. This commit explicitly declares consoleSize unspecified in that condition, so runtimes are free to do what they want short of erroring out. I considered making the property undefined or requiring it to be unset, but those seemed too strict given our permissive "MUST ignore unknown properties" extensibility requirement. [1]: opencontainers#563 Signed-off-by: W. Trevor King <wking@tremily.us>
…r unset The old language is from a502caf (config: Add consoleSize to process, 2016-09-14, opencontainers#563), where nobody commented on the "if attached" wording [1]. But reading the old line now, it's not clear to me what consoleSize means when terminal is not true. This commit explicitly declares consoleSize ignored in that condition. I'd rather have made it unspecified, so runtimes are free to do what they want short of erroring out, but Michael wanted the more specific "ignored" [2]. I considered making the property undefined or requiring it to be unset, but those seemed too strict given our permissive "MUST ignore unknown properties" extensibility requirement. [1]: opencontainers#563 [2]: opencontainers#863 (comment) Signed-off-by: W. Trevor King <wking@tremily.us>
Signed-off-by: John Howard jhoward@microsoft.com
Extracting pieces from the proof of concept PR for Windows OCI support at #504. This adds the
consoleSize
platform specific field to theProcess
structure.