Commit Graph

100 Commits

Author SHA1 Message Date
W. Trevor King 327a6367f0 Makefile: Remove unnecessary .PHONY entries
The only .PHONY entry we *need* is for schema/validate, since that's a
real file but we haven't told Make about its real dependencies (which
involve complicated Go lookups).  I'm personally in favor of using
.PHONY for all targets that aren't on-disk files, because it hints to
readers that the rule is not generating a file at the target.  But
there has been resistance to adding .PHONY entries to all such cases
(e.g. [1,2]), so this commit brings us around to a
internally-consistent "only use .PHONY when you always need it"
position.

That means that, for example, users who create files named 'clean'
will turn 'clean' the target into a no-op, but runtime-spec
maintainers are ok with that.

[1]: https://github.com/opencontainers/runtime-spec/pull/791#issuecomment-300369882
[2]: https://github.com/opencontainers/runtime-spec/pull/791#issuecomment-300612827

Signed-off-by: W. Trevor King <wking@tremily.us>
2017-05-10 16:54:53 -07:00
Michael Crosby 57a587635d Merge pull request #701 from wking/optional-process
config: Make process optional
2017-05-10 15:03:06 -07:00
Tianon Gravi 60fa44d737 Merge pull request #703 from Mashimiao/schema-fix-user
schema: add username for user field
2017-05-10 08:14:36 -07: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
Michael Crosby e1b2e61320 Merge pull request #764 from wking/strictly-positive-timeout
config: Require strictly-positive timeout values
2017-05-09 13:43:24 -07:00
W. Trevor King 0b7efd2235 schema: Add 'test' target to the Makefile
And fill in some known-good and known-bad examples.  We can make this
as detailed as we want, but this commit just adds enough to know that:

* The full-file spec examples are valid.
* The JSON Schema can distinguish valid examples from invalid JSON.

This will help catch JSON Schema typos like those being addressed by
[1].

[1]: https://github.com/opencontainers/runtime-spec/pull/784

Signed-off-by: W. Trevor King <wking@tremily.us>
2017-05-09 11:10:49 -07:00
Michael Crosby 70e26370d8 Merge pull request #784 from q384566678/schema-fix
schema: bug fixes
2017-05-09 09:48:59 -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 11d1ae747c schema: Format fix
Signed-off-by: zhouhao <zhouhao@cn.fujitsu.com>
2017-04-27 13:57:49 +08:00
zhouhao 79494b2175 schema: Fix the error
Signed-off-by: zhouhao <zhouhao@cn.fujitsu.com>
2017-04-27 13:49:18 +08:00
Mrunal Patel 13895d6074 Merge pull request #775 from q384566678/rootfs-enum
schema: Add enumeration to rootfsPropagation values
2017-04-26 15:59:09 -07: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
v1.0.0.batts c6bff91450 Merge pull request #769 from wking/require-syscall-names
config-linux: Require at least one entry in linux.seccomp.sycalls[].names
2017-04-26 11:26:05 -04:00
Mrunal Patel cb90a82fc1 Merge pull request #778 from wking/schema-makefile-phony
schema/Makefile: Add .PHONY declarations for phony targets
2017-04-26 08:08:27 -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 45cd926102 schema/Makefile: Add .PHONY declarations for phony targets
The only non-phony target (where the target name matches the output
file) is 'validate', but we need .PHONY there because the Go
dependencies are not represented in the Makefile.  This commit adds
the missing .PHONY declarations to the other targets, which truly are
phony.

Signed-off-by: W. Trevor King <wking@tremily.us>
2017-04-24 13:47:03 -07:00
zhouhao a084798c96 schema: Add enumeration to rootfsPropagation values
Signed-off-by: zhouhao <zhouhao@cn.fujitsu.com>
2017-04-21 13:29:13 +08:00
zhouhao df784c5fb8 schema: add clean to Makefile
Signed-off-by: zhouhao <zhouhao@cn.fujitsu.com>
2017-04-18 17:51:15 +08:00
W. Trevor King ecf73148cb config: Require strictly-positive timeout values
If the timeout value was zero, the hook would always error, and there
doesn't seem to be much point to that.  And I'm not sure what negative
timeouts would mean.  By adding this restriction, we do not limit
useful hook entries, and we give the validation code grounds to warn
users attempting to validate configs which are poorly defined or have
useless hook entries.

I'd like to remove the pointer from the Go type to comply with our
anti-pointer zero-value style (style.md) now that Go's zero-value is
clearly invalid.  However, there has been maintainer resistance to
removing the pointer [1] (although I don't think this is consistent
with previous maintainer statements that we don't need pointers when
the zero value is invalid [2]).  In order to land the normative spec
change, this commit keeps the current *int for Hook.Timeout and punts
a consistent policy to future work.

[1]: https://github.com/opencontainers/runtime-spec/pull/764#discussion_r111607155
[2]: https://github.com/opencontainers/runtime-spec/pull/653#issuecomment-272253010

Signed-off-by: W. Trevor King <wking@tremily.us>
2017-04-15 10:18:29 -07:00
W. Trevor King 5c62f9b839 config-linux: Require at least one entry in linux.seccomp.sycalls[].names
I expect the (undocumented) intention here is to iterate through
'names' and call seccomp_rule_add(3) or similar for each name.  In
that case, an empty 'names' makes the whole syscall entry a no-op, and
with this commit we can warn users who are validating such configs.

If, on the other hand, we were comfortable with no-op syscall entries,
we'd want to make 'names' OPTIONAL.

Warning folks who accidentally empty (or don't set) 'names' seems more
useful to me, and doesn't restrict the useful config space, so that's
what I've gone with in this commit.

minItems is documented in [1], and there is an example of its use in
[2]:

  "options": {
    "type": "array",
    "minItems": 1,
    "items": { "type": "string" },
    "uniqueItems": true
  },

[1]: https://tools.ietf.org/html/draft-wright-json-schema-validation-00#section-5.11
[2]: http://json-schema.org/example2.html

Signed-off-by: W. Trevor King <wking@tremily.us>
2017-04-12 10:17:13 -07:00
zhouhao 8b8afafec7 Makefile: modify the default value
Signed-off-by: zhouhao <zhouhao@cn.fujitsu.com>
2017-04-10 09:40:24 +08:00
zhouhao 3324e7e876 schema: add .PHONY to validate
Signed-off-by: zhouhao <zhouhao@cn.fujitsu.com>
2017-03-30 11:19:11 +08:00
W. Trevor King 5bf9b95c45 schema/defs-linux: Fix type for seccomp names
The:

  "type": [
    "string"
  ]

syntax added in 652323cd (improve seccomp format to be more
expressive, 2017-01-13, #657) is not valid:

  $ ./validate ./config-schema.json <../config.json
  The document is not valid. see errors :
  - linux.seccomp.syscalls.0.names: Invalid type. Expected: string, given: array

Signed-off-by: W. Trevor King <wking@tremily.us>
2017-03-06 12:15:47 -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 2db839104d Merge pull request #699 from crosbymichael/mount-optional
Make mount type and source optional
2017-02-28 20:05:03 -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
Ma Shimiao a4ff8879bc schema: add username for user field
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2017-02-28 17:58:08 +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 2d491b03fa Merge pull request #694 from q384566678/state-json
state-schema.json: add the value of status
2017-02-27 11:19:26 -08:00
Mrunal Patel fb76f47bf4 Merge pull request #696 from q384566678/json-fix
Fix config-schema.json
2017-02-27 11:19:04 -08:00
zhouhao ec49ba1ada remove mounts from required
Signed-off-by: zhouhao <zhouhao@cn.fujitsu.com>
2017-02-27 09:29:01 +08:00
zhouhao 0a8ef1d7b5 config-schema.json: add required
Signed-off-by: zhouhao <zhouhao@cn.fujitsu.com>
2017-02-27 09:27:04 +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
zhouhao 7ec622e5c3 state-schema.json: add the value of status
Signed-off-by: zhouhao <zhouhao@cn.fujitsu.com>
2017-02-24 13:33:54 +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
Mrunal Patel ac9f8e0b5f Merge pull request #675 from crosbymichael/caps
Add ambient and bounding capability support
2017-02-22 14:59:11 -08: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 8c22b690a4 Merge pull request #688 from Mashimiao/schema-fix-device-required
schema: remove major,minor from device required items
2017-02-17 10:18:30 -08:00
Ma Shimiao 0e808fcad0 schema: remove major,minor from device required items
When type is p, major and minor is not required.
So, we should not leave them in require.

Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2017-02-14 14:15:12 +08:00
Ma Shimiao fcd62099ff config.md: args of Hooks should be optional
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2017-02-09 09:45:42 +08:00
Vincent Batts 67c81aa3c6 Merge pull request #684 from Mashimiao/schema-fix-invalid-types
schema: fix invalid types
2017-02-08 15:24:26 -05:00
Ma Shimiao 4100020dfc schema: fix invalid types
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2017-02-08 16:35:45 +08:00
Deng Guangxing 21ee162b42 add explicit usage message to validate and some fix
this commit contains:
* add explicit usage message to validate
* schemaPath was overrided by filepath.Abs(), schemaLoader would not get
* the abs path.
* check local scheme and document file path with os.Stat()

Signed-off-by: Deng Guangxing <dengguangxing@huawei.com>
2017-02-08 15:18:18 +08:00
Qiang Huang 2392e66f16 Merge pull request #674 from crosbymichael/state
Rename bundlePath to bundle
2017-02-06 10:43:17 +08:00
Michael Crosby 5d3f1674e6 Rename bundlePath to bundle
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-02-02 13:10:54 -08:00
W. Trevor King 092743727e schema: Drop pointers and nulls
Maintainers feel (and I agree) that there's no point in explicitly
allowing a null value when callers can simply leave the property unset
[1].  This commit removes all references to "pointer" and "null" from
the JSON Schema to support that decision.  While optional properties
may sometimes be represented as pointer types in Go [2], optional
properties should be represented in JSON Schema by not including the
properties in the 'required' array.

[1]: https://github.com/opencontainers/runtime-spec/pull/555#issuecomment-272020515
[2]: style.md "Optional settings should not have pointer Go types"

Signed-off-by: W. Trevor King <wking@tremily.us>
2017-01-23 11:23:44 -08:00