You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
WIP: Copy/paste new Markdown and Go for hypervisor
Michael asked for this [1], because it allows you to extend one schema
without extending the other (the terminal properties are an example of
this). I think the overlap is much greater than the differences, so
I'd rather use the previous commit's "is is the same, except for ..."
approach. But as far as configurations are concerned, the two
approaches are identical, so I don't really care.
I've left the JSON Schema change off this commit for now, I'll go back
through and adjust that once we have a maintainer confirming the
copy/paste approach.
[1]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2018/opencontainers.2018-03-07-22.00.log.html#l-53
Signed-off-by: W. Trevor King <wking@tremily.us>
**`hypervisor`** (object, OPTIONAL) configures the hypervisor process.
9
-
It has the same schema as [`process`](config.md#process), but `terminal` and `consoleSize` MUST NOT be configured.
9
+
The schema is a subset of the [`process`](config.md#process) schema with the terminal properties `terminal` and `consoleSize` removed.
10
+
11
+
***`cwd`** (string, REQUIRED) is the working directory that will be set for the executable.
12
+
This value MUST be an absolute path.
13
+
***`env`** (array of strings, OPTIONAL) with the same semantics as [IEEE Std 1003.1-2008's `environ`][ieee-1003.1-2008-xbd-c8.1_2].
14
+
***`args`** (array of strings, REQUIRED) with similar semantics to [IEEE Std 1003.1-2008 `execvp`'s *argv*][ieee-1003.1-2008-functions-exec_2].
15
+
This specification extends the IEEE standard in that at least one entry is REQUIRED, and that entry is used with the same semantics as `execvp`'s *file*.
16
+
17
+
### <aname="HypervisorPOSIXProcess" />POSIX process
18
+
19
+
For systems that support POSIX rlimits (for example Linux and Solaris), the `hypervisor` object supports the following process-specific properties:
20
+
21
+
***`rlimits`** (array of objects, OPTIONAL) allows setting resource limits for the process.
22
+
Each entry has the following structure:
23
+
24
+
***`type`** (string, REQUIRED) the platform resource being limited.
25
+
* Linux: valid values are defined in the [`getrlimit(2)`][getrlimit.2_2] man page, such as `RLIMIT_MSGQUEUE`.
26
+
* Solaris: valid values are defined in the [`getrlimit(3)`][getrlimit.3_2] man page, such as `RLIMIT_CORE`.
27
+
28
+
The runtime MUST [generate an error](runtime.md#errors) for any values which cannot be mapped to a relevant kernel interface.
29
+
For each entry in `rlimits`, a [`getrlimit(3)`][getrlimit.3_2] on `type` MUST succeed.
30
+
For the following properties, `rlim` refers to the status returned by the `getrlimit(3)` call.
31
+
32
+
***`soft`** (uint64, REQUIRED) the value of the limit enforced for the corresponding resource.
33
+
`rlim.rlim_cur` MUST match the configured value.
34
+
***`hard`** (uint64, REQUIRED) the ceiling for the soft limit that could be set by an unprivileged process.
35
+
`rlim.rlim_max` MUST match the configured value.
36
+
Only a privileged process (e.g. one with the `CAP_SYS_RESOURCE` capability) can raise a hard limit.
37
+
38
+
If `rlimits` contains duplicated entries with same `type`, the runtime MUST [generate an error](runtime.md#errors).
39
+
40
+
### <aname="HypervisorLinuxProcess" />Linux Process
41
+
42
+
For Linux-based systems, the `hypervisor` object supports the following process-specific properties.
43
+
44
+
***`apparmorProfile`** (string, OPTIONAL) specifies the name of the AppArmor profile for the process.
45
+
For more information about AppArmor, see [AppArmor documentation][apparmor_2].
46
+
***`capabilities`** (object, OPTIONAL) is an object containing arrays that specifies the sets of capabilities for the process.
47
+
Valid values are defined in the [capabilities(7)][capabilities.7_2] man page, such as `CAP_CHOWN`.
48
+
Any value which cannot be mapped to a relevant kernel interface MUST cause an error.
49
+
`capabilities` contains the following properties:
50
+
51
+
***`effective`** (array of strings, OPTIONAL) the `effective` field is an array of effective capabilities that are kept for the process.
52
+
***`bounding`** (array of strings, OPTIONAL) the `bounding` field is an array of bounding capabilities that are kept for the process.
53
+
***`inheritable`** (array of strings, OPTIONAL) the `inheritable` field is an array of inheritable capabilities that are kept for the process.
54
+
***`permitted`** (array of strings, OPTIONAL) the `permitted` field is an array of permitted capabilities that are kept for the process.
55
+
***`ambient`** (array of strings, OPTIONAL) the `ambient` field is an array of ambient capabilities that are kept for the process.
56
+
***`noNewPrivileges`** (bool, OPTIONAL) setting `noNewPrivileges` to true prevents the process from gaining additional privileges.
57
+
As an example, the [`no_new_privs`][no-new-privs_2] article in the kernel documentation has information on how this is achieved using a `prctl` system call on Linux.
58
+
***`oomScoreAdj`***(int, OPTIONAL)* adjusts the oom-killer score in `[pid]/oom_score_adj` for the process's `[pid]` in a [proc pseudo-filesystem][proc_3].
59
+
If `oomScoreAdj` is set, the runtime MUST set `oom_score_adj` to the given value.
60
+
If `oomScoreAdj` is not set, the runtime MUST NOT change the value of `oom_score_adj`.
61
+
***`selinuxLabel`** (string, OPTIONAL) specifies the SELinux label for the process.
62
+
For more information about SELinux, see [SELinux documentation][selinux_2].
63
+
64
+
### <aname="HypervisorUser" />User
65
+
66
+
The user for the process is a platform-specific structure that allows specific control over which user the process runs as.
67
+
68
+
#### <aname="HypervisorPOSIXUser" />POSIX-platform User
69
+
70
+
For POSIX platforms the `user` structure has the following fields:
71
+
72
+
***`uid`** (int, REQUIRED) specifies the user ID in the [container namespace](glossary.md#container-namespace).
73
+
***`gid`** (int, REQUIRED) specifies the group ID in the [container namespace](glossary.md#container-namespace).
74
+
***`additionalGids`** (array of ints, OPTIONAL) specifies additional group IDs in the [container namespace](glossary.md#container-namespace) to be added to the process.
75
+
76
+
_Note: symbolic name for uid and gid, such as uname and gname respectively, are left to upper levels to derive (i.e. `/etc/passwd` parsing, NSS, etc)_
77
+
78
+
#### <aname="HypervisorWindowsUser" />Windows User
79
+
80
+
For Windows based systems the user structure has the following fields:
81
+
82
+
***`username`** (string, OPTIONAL) specifies the user name for the process.
10
83
11
84
### Example
12
85
@@ -58,3 +131,14 @@ This image contains the root filesystem that the virtual machine **`kernel`** wi
0 commit comments