Commit Graph

84 Commits

Author SHA1 Message Date
Michael Crosby 57a587635d Merge pull request #701 from wking/optional-process
config: Make process optional
2017-05-10 15:03:06 -07:00
Ma Shimiao 3864175855 small typo fix
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2017-05-10 19:57:34 +08:00
Daniel, Dao Quang Minh 8202372717 Merge pull request #789 from wking/move-oom-adj-to-process
config: Shift oomScoreAdj from linux.resources to process
2017-05-09 23:19:05 -05:00
W. Trevor King 4b49c64a88 config: Shift oomScoreAdj from linux.resources to process
The only discussion related to this is in [1,2], where the
relationship between oomScoreAdj and disableOOMKiller is raised. But
since 429f936 (Adding cgroups path to the Spec, 2015-09-02, #137)
resources has been tied to cgroups, and oomScoreAdj is not about
cgroups.  For example, we currently have (in config-linux.md):

  You can configure a container's cgroups via the resources field of
  the Linux configuration.

I suggested we move the property from linux.resources.oomScoreAdj to
linux.oomScoreAdj so config authors and runtimes don't have to worry
about what cgroupsPath means if the only entry in resources is
oomScoreAdj.  Michael responded with [4]:

  If anything it should probably go on the process

So that's what this commit does.

I've gone with the four-space indents here to keep Pandoc happy (see
7795661 (runtime.md: Fix sub-bullet indentation, 2016-06-08, #495),
but have left the existing entries in this list unchanged to reduce
churn.

[1]: https://github.com/opencontainers/runtime-spec/pull/236
[2]: https://github.com/opencontainers/runtime-spec/pull/292
[3]: https://github.com/opencontainers/runtime-spec/pull/137
[4]: https://github.com/opencontainers/runtime-spec/issues/782#issuecomment-299990075

Signed-off-by: W. Trevor King <wking@tremily.us>
2017-05-09 16:46:30 -07:00
W. Trevor King d42b44b8ff specs-go/config: Use a pointer for Process.ConsoleSize
Avoid injecting:

  "consoleSize":{"height":0,"width":0}

when serializing with Go's stock JSON serializer. Using a pointer for
this optional struct property works around [1].

[1]: https://github.com/golang/go/issues/11939

Signed-off-by: W. Trevor King <wking@tremily.us>
2017-05-09 14:10:54 -07:00
Michael Crosby 6a17a38085 Merge pull request #783 from q384566678/range-limt
Remove range limit
2017-05-09 09:48:17 -07:00
Darren Stahl aaed975b55 Remove Memory reservation on Windows
Signed-off-by: Darren Stahl <darst@microsoft.com>
2017-05-08 17:41:51 -07:00
Darren Stahl 7d007ca1d4 Change Windows CPU Percent to Maximum
In order to increase the granularity of CPU resource control, change
the CPU Percent (0-100) resource setting to CPU Maximum (0-10000)

Signed-off-by: Darren Stahl <darst@microsoft.com>
2017-05-08 14:08:26 -07:00
zhouhao d417d39f85 Remove range limit
Signed-off-by: zhouhao <zhouhao@cn.fujitsu.com>
2017-04-27 13:42:47 +08:00
Tianon Gravi 138ad89ca8 Merge pull request #768 from wking/optional-syscalls
config-linux: Make linux.seccomp.syscalls OPTIONAL
2017-04-26 08:29:52 -07:00
Qiang Huang ce55de2517 Remove range limit which depend on kernel
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2017-04-26 22:46:02 +08:00
W. Trevor King 42984e8d3c config-linux: Make linux.seccomp.syscalls OPTIONAL
Before this commit, linux.seccomp.sycalls was required, but we didn't
require an entry in the array.  That means '"syscalls": []' would be
technically valid, and I'm pretty sure that's not what we want.

If it makes sense to have a seccomp property that does not need
syscalls entries, then syscalls should be optional (which is what this
commit is doing).

If it does not makes sense to have an empty/unset syscalls then it
should be required and have a minimum length of one.

Before 652323c (improve seccomp format to be more expressive,
2017-01-13, #657), syscalls was omitempty (and therefore more
optional-feeling, although there was no real Markdown spec for seccomp
before 3ca5c6c, config-linux.md: fix seccomp, 2017-03-02, #706, so
it's hard to know).  This commit has gone with OPTIONAL, because a
seccomp config which only sets defaultAction seems potentially valid.

The SCMP_ACT_KILL example is prompted by:

On Tue, Apr 25, 2017 at 01:32:26PM -0700, David Lyle wrote [1]:
> Technically, OPTIONAL is the right value, but unless you specify the
> default action for seccomp to be SCMP_ACT_ALLOW the result will be
> an error at run time.
>
> I would suggest an additional clarification to this fact in
> config-linux.md would be very helpful if marking syscall as
> OPTIONAL.

I've phrased the example more conservatively, because I'm not sure
that SCMP_ACT_ALLOW is the only possible value to avoid an error.  For
example, perhaps a SCMP_ACT_TRACE default with an empty syscalls array
would not die on the first syscall.  The point of the example is to
remind config authors that without a useful syscalls array, the
default value is very important ;).

Also add the previously-missing 'required' property to the seccomp
JSON Schema entry.

[1]: https://github.com/opencontainers/runtime-spec/pull/768#issuecomment-297156102

Signed-off-by: W. Trevor King <wking@tremily.us>
2017-04-25 15:06:57 -07:00
W. Trevor King bb4cca78cd specs-go/config: Add omitempty to LinuxSyscall.Args
It used to have this, but the omitempty was dropped in 652323cd
(improve seccomp format to be more expressive, 2017-01-13, #657).
However, the docs that landed in 3ca5c6c5 (config-linux.md: fix
seccomp, 2017-03-02, #706) list the property as optional, and if it is
optional, we can leave it unset instead of serializing an empty array.

Signed-off-by: W. Trevor King <wking@tremily.us>
2017-04-06 23:13:22 -07:00
Ma Shimiao 627f5338cc specs-go/config.go: format code
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2017-03-13 13:43:53 +08:00
Mrunal Patel 76159da8ca Merge pull request #630 from xiaochenshen/rdt-cat-resctrl-cgroup-v1
specs-go/config: add Intel RDT/CAT Linux support
2017-03-10 09:41:16 -08:00
Xiaochen Shen 73a6002bf3 specs-go/config: add Intel RDT/CAT Linux support
Add support for Intel Resource Director Technology (RDT) / Cache Allocation
Technology (CAT). Add L3 cache resource constraints in Linux-specific
configuration.

This is the prerequisite of this runc proposal:
https://github.com/opencontainers/runc/issues/433

For more information about Intel RDT/CAT, please refer to:
https://github.com/opencontainers/runc/issues/433

Signed-off-by: Xiaochen Shen <xiaochen.shen@intel.com>
2017-03-10 17:29:08 +08:00
zhouhao 90427c9345 remove comment
Signed-off-by: zhouhao <zhouhao@cn.fujitsu.com>
2017-03-10 09:19:28 +08:00
zhouhao 513ab686e9 Add new architectures from libseccomp 2.3.2
Signed-off-by: zhouhao <zhouhao@cn.fujitsu.com>
2017-03-02 14:33:06 +08:00
Mrunal Patel 40474dd78c Merge pull request #704 from hqhq/use_uint64_for_memory
Set specs value the same as kernel API input
2017-03-01 14:05:37 -08:00
Qiang Huang ec9449187b Set specs value the same as kernel API input
This partially revert #648 , after a second thought, I think we
should use specs value the same as kernel API input, see:
https://github.com/opencontainers/runtime-spec/issues/692#issuecomment-281889852

For memory and hugetlb limits *.limit_in_bytes, cgroup APIs take the values
as string, but the parsed values are unsigned long, see:
https://github.com/torvalds/linux/blob/v4.10/mm/page_counter.c#L175-L193

For `cpu.cfs_quota_us` and `cpu.rt_runtime_us`, cgroup APIs take the input
value as signed long long, while `cpu.cfs_period_us` and `cpu.rt_periof_us`
take the input value as unsigned long long.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2017-03-01 09:10:43 +08:00
Michael Crosby 52461516ea Make mount type and source optional
These are optional on multiple platforms and should be left up to the
runtime/host system for validation.

Closes #470

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-02-28 13:50:18 -08:00
W. Trevor King c41ea83d84 config: Make process optional
Since be59415 (Split create and start, 2016-04-01, #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]: https://github.com/opencontainers/runtime-spec/pull/417#issuecomment-216076069
[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: <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]: https://github.com/opencontainers/runtime-spec/pull/417#issuecomment-216937010
[5]: https://github.com/opencontainers/runtime-spec/pull/417#issuecomment-216937090
[6]: https://github.com/opencontainers/runtime-spec/issues/618#issuecomment-277105273
[7]: https://github.com/opencontainers/runtime-spec/pull/700

Signed-off-by: W. Trevor King <wking@tremily.us>
2017-02-27 12:39:14 -08:00
Mrunal Patel ae7a541930 Merge pull request #657 from GrantSeltzer/improve-seccomp-spec
config: Improve seccomp format to be more expressive
2017-02-24 18:59:49 -08:00
grantseltzer 652323cd77 improve seccomp format to be more expressive
Signed-off-by: grantseltzer <grantseltzer@gmail.com>
2017-02-22 18:17:16 -05:00
Michael Crosby eb114f0570 Add ambient and bounding capability support
Closes #668

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-02-22 14:47:51 -08:00
Mrunal Patel 868e631000 Remove string pointers
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-01-12 10:04:13 -08:00
Qiang Huang 4b42ec4480 Merge pull request #648 from hqhq/all_negative_value
Allow negative value for some resource fields
2017-01-09 21:00:19 -06:00
Qiang Huang 082e93a2bd Allow negative value for some resource fields
Carry #499

For these values, cgroup kernal APIs accept -1 to set
them as unlimited, as docker and runc all support
update resources, we should not set drawbacks in spec.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2017-01-05 19:03:57 +08:00
W. Trevor King a78f255982 config: Explicitly list 'hooks' as optional
And make it omitempty, otherwise:

  $ ocitools generate --template <(echo '{}')
  $ cat config.json | jq -S .
  {
    "hooks": {},
    ...
  }

To provide space for the type information and 'optional', I've
shuffled the hook docs to follow our usual:

  * **`{property}`** ({type}, {when-needed}) {notes}

format.  I've kept the separate event-trigger sections (e.g. "###
Prestart") since they go into more detail on the timing, purpose, and
exit handling for the different events (and that seemed like too much
information to put into the nested lists).

I've replaced the Go reference from 48049d2 (Clarify the semantics of
hook elements, 2015-11-25, #255) with POSIX references (following the
new process docs) to address pushback against referencing Go [1,2] in
favor of POSIX links [3].  Rob Dolin had suggested
"platform-appropriate" wording [4], but it seems like Visual Studio
2015 supports execv [5], and providing an explicit
"platform-appropriate" wiggle seems like it's adding useless
complication.

[1]: https://github.com/opencontainers/runtime-spec/pull/427#discussion_r62362761
[2]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2016/opencontainers.2016-05-18-17.01.log.html#l-46
[3]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2016/opencontainers.2016-05-18-17.01.log.html#l-52
[4]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2016/opencontainers.2016-05-18-17.01.log.html#l-54
[5]: https://msdn.microsoft.com/en-us/library/886kc0as.aspx

Signed-off-by: W. Trevor King <wking@tremily.us>
2017-01-04 14:12:16 -08:00
Ma Shimiao f305e643dc spec-go/config: comment fix
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2016-11-14 16:14:22 +08:00
Mrunal Patel dc42b45811 Merge pull request #601 from hqhq/rewrite_idmapping
Rewrite LinuxIDMappings
2016-10-31 13:58:45 -07:00
Ma Shimiao ef9ce84cf9 specs-go/config: fix required items type
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2016-10-31 09:18:11 +08:00
Qiang Huang 621684f645 Rewrite LinuxIDMappings
Basicly make the format consistent with others, no
semantics change.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2016-10-27 19:00:39 +08:00
Michael Crosby a39be468c9 Merge pull request #567 from jhowardmsft/jjh/aggressivenamespacing
Aggressive namespacing
2016-09-30 09:46:08 -07:00
Vincent Batts 1c7c27d043 Merge pull request #573 from jhowardmsft/jjh/addwindows
Add support for Windows based containers
2016-09-26 16:19:32 -04:00
John Howard dc8f2c2e6e Add support for Windows-based containers
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-09-22 12:13:04 -07:00
John Howard a502caf65f config: Add consoleSize to process
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-09-20 15:19:27 -07:00
John Howard e918daac26 Aggressive namespacing
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-09-20 15:05:29 -07:00
Mrunal Patel 7bce59f225 Merge pull request #564 from jhowardmsft/jjh/processplatformtags
Platform annotations on `Process` struct
2016-09-20 14:18:47 -07:00
John Howard ce3ac33d77 Platform markers on Process struct
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-09-15 10:23:45 -07:00
W. Trevor King e086a3e33c specs-go/config: Drop "this field is platform dependent" (again)
We dropped these in 47740802 (specs-go/config: Drop "this field is
platform dependent", 2016-09-14, #568) but f9e48e00 (Windows: User
struct changes, 2016-09-14, #565) was developed in parallel and
brought in a new one.

Signed-off-by: W. Trevor King <wking@tremily.us>
2016-09-15 08:27:29 -07:00
Vincent Batts a992b1b72a Merge pull request #565 from jhowardmsft/jjh/user
Windows: User struct changes
2016-09-15 11:21:57 -04:00
W. Trevor King 47740802f8 specs-go/config: Drop "this field is platform dependent"
These comments first landed in 820131db (*: flatten platform dependent
source, 2016-03-08, #310).  But you can tell they're platform
dependent by the platform:"..." tags.  The Go comment doesn't add
any additional information.

Signed-off-by: W. Trevor King <wking@tremily.us>
2016-09-14 16:23:45 -07:00
John Howard f9e48e0024 Windows: User struct changes
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-09-14 16:14:38 -07:00
Qiang Huang 069e8e1c16 Merge pull request #531 from wking/pointer-omitempty
specs-go/config: Make KernelTCP and ClassID omitempty
2016-08-26 09:55:28 +08:00
Mrunal Patel 90027b005b Merge pull request #525 from wking/go-comment-sync
config: Synchronize comments between Markdown and Go
2016-08-17 11:03:15 -07:00
W. Trevor King 980ed05aa5 specs-go/config: Make KernelTCP and ClassID omitempty
Found with:

  $ git grep ' \*' origin/master -- specs-go/*.go | grep -v omitempty
  origin/master:specs-go/config.go:       KernelTCP *uint64 `json:"kernelTCP"`
  origin/master:specs-go/config.go:       ClassID *uint32 `json:"classID"`

Both settings are optional:

  $ git grep '`kernelTCP`\|`classID`' origin/master
  origin/master:config-linux.md:* **`kernelTCP`** *(uint64, optional)* - ...
  origin/master:config-linux.md:* **`classID`** *(uint32, optional)* - ...

Signed-off-by: W. Trevor King <wking@tremily.us>
2016-08-13 09:40:47 -07:00
W. Trevor King 054d2df15a config-linux: Make linux.resources.devices explicitly optional
And mark it omitempty to avoid:

  $ ocitools generate --template <(echo '{"linux": {"resources": {}}}') | jq .linux
  {
    "resources": {
      "devices": null
    }
  }

Signed-off-by: W. Trevor King <wking@tremily.us>
2016-08-03 09:13:53 -07:00
W. Trevor King 7477fa519f config: config: Consistent Markdown/Go wording for 'annotations'
I've replaced the old OPTIONAL with our usual:

  (<type>, <optional|required>)

to get the property name first, since that translates more directly
into a Go comment that godoc will like.

The new Go comment is much shorter, dropping "unstructured" (because
the Markdown says "structured or unstructured") and "set by external
tools..." (because *everything* in the configuration JSON is set by
external-to-the-runtime tools).

Signed-off-by: W. Trevor King <wking@tremily.us>
2016-08-03 00:18:07 -07:00
W. Trevor King 9837b6b725 config: Consistent Markdown/Go wording for 'hooks'
The new wording isn't particularly close to either of the old
wordings, but it reads more clearly to me.  I've also added our usual:

  (<type>, <required|optional>)

to the Markdown so folks can see that this is an optional object
(although see [1] for a more complete version).

[1]: https://github.com/opencontainers/runtime-spec/pull/427
     Subject: config: Explicitly list 'hooks' as optional

Signed-off-by: W. Trevor King <wking@tremily.us>
2016-08-03 00:16:35 -07:00