Commit Graph

544 Commits

Author SHA1 Message Date
Antonio Murdaca 5ded78475c *: fix typos
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2016-03-21 11:51:19 +01:00
Giuseppe Scrivano f4950a17c2 specs: fix typo
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2016-03-21 11:33:43 +01:00
Mrunal Patel e23fbbb408 Merge pull request #346 from crosbymichael/hook-timeout
Add timeout field to hooks
2016-03-18 10:21:31 -07:00
Michael Crosby 7aeccd73da Merge pull request #328 from hqhq/hq_update_associated_projects
Update associated projects
2016-03-18 10:20:34 -07:00
Qiang Huang fd376358fd Update associated projects
Now we have ocitools in opencontainers, thanks @mrunalp .

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2016-03-18 11:22:51 +08:00
Vincent Batts a306c5841f Merge pull request #343 from crosbymichael/marshal-performance
Improve json encoding performance for specs-go
2016-03-16 21:35:28 -04:00
Vincent Batts 95f0c672a0 config: clarify the uname mapping
Closes #38

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-03-17 01:17:18 +00:00
Michael Crosby 5a3b1816b2 Add timeout field to hooks
So that runtimes don't lock up forever waiting on a hook to return I
added a timeout field.  This allows the author to specify the timeout in
seconds that they want the hook to run before aborting the hook and
container execution.

I think the hook is the proper place to specify a timeouot like this
because any type of overall timeout in the runtime will probably not
work for all hooks and will not be flexable enough.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-03-16 16:51:29 -07:00
Mrunal Patel a7a90d986d Merge pull request #275 from wking/namespace-host-paths
config-linux: Specify host mount namespace for namespace paths
2016-03-16 14:55:00 -07:00
W. Trevor King 5dad125595 config-linux: Specify host mount namespace for namespace paths
Avoid trouble with situations like:

  # mount --bind /mnt/test /mnt/test
  # mount --make-rprivate /mnt/test
  # touch /mnt/test/mnt /mnt/test/user
  # mount --bind /proc/123/ns/mnt /mnt/test/mnt
  # mount --bind /proc/123/ns/user /mnt/test/user
  # nsenter --mount=/proc/123/ns/mnt --user /proc/123/ns/user sh

which uses the required private mount for binding mount namespace
references [1,2,3].  We want to avoid:

1. Runtime opens /mnt/test/mnt as fd 3.
2. Runtime joins the mount namespace referenced by fd 3.
3. Runtime fails to open /mnt/test/user, because /mnt/test is not
   visible in the current mount namespace.

and instead get runtime authors to setup flows like:

1. Runtime opens /mnt/test/mnt as fd 3.
2. Runtime opens /mnt/test/user as fd 4.
3. Runtime joins the mount namespace referenced by fd 3.
4. Runtime joins the user namespace referenced by fd 4.

This also applies to new namespace creation.  We want to avoid:

1. Runtime clones a container process with a new mount namespace.
2c. Container process fails to open /mnt/test/user, because /mnt/test
    is not visible in the current mount namespace.

in favor of something like:

1. Runtime opens /mnt/test/user as fd 3.
2. Runtime clones a container process with a new mount namespace.
3h. Host process closes unneeded fd 3.
3c. Container process joins the user namespace referenced by fd 3.

I also define runtime and container namespaces, so we have consistent
terminology.  I prefer:

* host namespace: a namespace you are in when you invoke the runtime
* host process: the runtime process invoked by the user
* container process: the process created by a clone call in the host
  process which will eventually execute the user-configured process.

Both the host and container processes are running runtime code
(although the container process eventually transitions to
user-configured code), so I find "runtime process", "runtime
namespace", etc. to be imprecise.  However, the maintainer consensus
is for "runtime namespace" [4,5], so that's what we're going with
here.

[1]: http://karelzak.blogspot.com/2015/04/persistent-namespaces.html
[2]: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=4ce5d2b1a8fde84c0eebe70652cf28b9beda6b4e
[3]: http://mid.gmane.org/87haeahkzc.fsf@xmission.com
[4]: https://github.com/opencontainers/specs/pull/275#discussion_r48057211
[5]: https://github.com/opencontainers/specs/pull/275#discussion_r48324264

Signed-off-by: W. Trevor King <wking@tremily.us>
2016-03-16 14:47:29 -07:00
Michael Crosby cfec788d67 Add makefile target for ffjson
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-03-16 11:30:16 -07:00
Mrunal Patel b8d67bbaf1 Merge pull request #342 from wking/canonical-markdown-and-go-links
config: Make Markdown canonical
2016-03-16 10:30:21 -07:00
Vincent Batts 4d4a07952e Merge pull request #340 from liangchenye/master
add omitempty to 'Devices
2016-03-16 13:27:20 -04:00
Michael Crosby 4e99e8fb89 Use ffjson for faster marshal and unmarshal
By using ffjson for json encoding we can reduce the time for encoding
and decoding.

Without:

BenchmarkMarsalSpec-4     100000             18276 ns/op
BenchmarkUnmarshal-4       30000             55115 ns/op

With:

BenchmarkMarsalSpec-4     100000             13649 ns/op
BenchmarkUnmarshal-4       50000             24747 ns/op

This is a reduces time about 25% on marshal and 50% on unmarshal.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-03-15 17:30:18 -07:00
Michael Crosby 7a00e0ce5e Add basic marshal tests
This adds basic benchmark tests for the performace of marshaling and
unmarshaling the spec into json.  These tests are helpful to optimize
the performace because the main way the spec is consumed is via json.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-03-15 17:21:40 -07:00
liangchenye 28cc423977 add omitempty to 'Device' and 'Namespace'
Signed-off-by: liangchenye <liangchenye@huawei.com>
2016-03-11 11:28:58 +08:00
W. Trevor King 2123330983 project: Update link to version.go now that it's in specs-go/
Catch up with 7bf06d5 (source and schema: differentiate with examples,
2015-12-18, #276).

Signed-off-by: W. Trevor King <wking@tremily.us>
2016-03-10 13:42:35 -08:00
W. Trevor King 160b4a262a config: Make Markdown canonical
Also:

* Update the link to Go bindings after 7bf06d5 (source and schema:
  differentiate with examples, 2015-12-18, #276).
* Add a reference to the JSON Schema after cdcabde (schema: JSON
  Schema and validator for `config.json`, 2016-01-19, #313).

It's pretty clear that the Go bindings cannot be canonical on their
own, because they do not define limits (e.g. the 0 through 512 range
for FileMode).  The JSON Schema is closer, but still does not cover
everything (e.g. "a directory must exist at root.path").  Both the Go
bindings and the JSON Schema could grow to cover the full spec by
adding that sort of thing to comments and descriptions, but that's not
how things seem to be working now.

Signed-off-by: W. Trevor King <wking@tremily.us>
2016-03-10 13:42:35 -08:00
Mrunal Patel 41031086f1 Merge pull request #336 from vbatts/bump-v0.4.0
Bump v0.4.0
2016-03-10 13:18:32 -08:00
Vincent Batts ab44e373ec version: bump v0.5.0-dev
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-03-10 18:54:08 +00:00
Vincent Batts 3ce138b193 version: v0.4.0
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-03-10 18:54:08 +00:00
W. Trevor King 698d93075b ChangeLog: Document changes since v0.3.0
Through 0bcb7119 (Merge pull request #341 2016-03-10).

Signed-off-by: W. Trevor King <wking@tremily.us>
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-03-10 18:53:53 +00:00
W. Trevor King 2042424786 ChangeLog: Strip trailing whitespace
Signed-off-by: W. Trevor King <wking@tremily.us>
2016-03-10 18:49:11 +00:00
Mrunal Patel 0bcb7119b7 Merge pull request #341 from cloudfoundry-incubator/move-rlimits-to-process
Move rlimits to process
2016-03-10 10:27:24 -08:00
Mrunal Patel 9b19e76405 Merge pull request #313 from vbatts/json-schema
json-schema: initial pass at schema and validator
2016-03-10 10:26:17 -08:00
Julian Friedman 9d9ed06d5e Move rlimits to process
Signed-off-by: Julian Friedman <julz.friedman@uk.ibm.com>
2016-03-10 09:44:43 +00:00
Julian Friedman 77f3b7b68f Nit: systems not systemd
Signed-off-by: Julian Friedman <julz.friedman@uk.ibm.com>
2016-03-10 09:30:00 +00:00
Michael Crosby dfd71f755e Merge pull request #337 from vbatts/carry-335
ReadMe: Update content to match print order
2016-03-09 17:03:57 -08:00
Vincent Batts eea2a6c15b Merge pull request #310 from vbatts/multi-platform
config: platform dependent reference source
2016-03-09 15:47:07 -05:00
Vincent Batts 820131db4a *: flatten platform dependent source
This introduces verbiage of fields that may occur in json (technically
optional), but is required on certain platforms (e.g. Linux).

The JSON document will look the same as it presently does, but now the
reference source compiles regardless of platform.

Not adding a "name" string to the user sturct, as that is not a
requirement yet.

In the event a windows runtime shows up, I could imagine an `sid` on the
user struct, but we'll get to that when it happens.

Closes https://github.com/opencontainers/specs/pull/135
Related to https://github.com/opencontainers/specs/issues/166

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-03-09 15:12:17 -05:00
Michael Crosby 9f909ab9d0 Merge pull request #339 from wking/selinux-key
specs-go/config: Fix 'SelinuxProcessLabel' -> 'SelinuxLabel'
2016-03-09 12:05:28 -08:00
W. Trevor King 59333dcf45 specs-go/config: Fix 'SelinuxProcessLabel' -> 'SelinuxLabel'
The label changed in 5a8a779f (Move process specific settings to
process, 2016-03-02, #329) and 7bf06d53 (source and schema:
differentiate with examples, 2015-12-18, #276) missed this instance
when rebasing around #329.

Signed-off-by: W. Trevor King <wking@tremily.us>
2016-03-09 12:00:51 -08:00
Mrunal Patel fae9a3e3ac Merge pull request #276 from vbatts/schema
source and schema: differentiate with examples
2016-03-09 11:52:55 -08:00
Michael Crosby d199438999 Merge pull request #338 from wking/drop-bluejeans
README: Drop BlueJeans link label definition
2016-03-09 11:46:13 -08:00
W. Trevor King ccc7e2fb53 README: Drop BlueJeans link label definition
The only reference was removed in 15a43acd (ReadMe: Replace BlueJeans
with UberConference, 2016-02-24, #326).

Signed-off-by: W. Trevor King <wking@tremily.us>
2016-03-09 11:45:47 -08:00
Vincent Batts cfbf70c0ab config: formatted example json
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-03-09 19:40:34 +00:00
Vincent Batts cdcabdeb6b schema: JSON Schema and validator for `config.json`
Conforming to https://tools.ietf.org/html/draft-zyp-json-schema-03
and http://json-schema.org/latest/json-schema-core.html

* Utilizes a number of JSON schema features, including 'pattern'
* Defined primitives, like integers, that we'll use
* Split out definitions for primitives and platform-specific
* Provide a Makefile for:
 - "fmt" target for *.json
 - "validate" target for building the validation tool

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-03-09 19:32:52 +00:00
Vincent Batts 7bf06d53dd source and schema: differentiate with examples
The standard is on the JSON schema (not yet IETF spec JSON-schema), such
that it is not implemenations specific. Thus far, the reference has been
in how golang source renders the JSON documents.

Having the JSON source and the markdown documents in sync has been an
ongoing step to keep in sync.

Separating these two allows the golang source to continue being _a_
reference, but the JSON schema in the documentation to be _the_
reference.

As validation tooling is refined, then it will facilitate ensuring
the available golang source conforms to the reference JSON.

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-03-09 19:18:20 +00:00
Mrunal Patel dae09c6a7d Merge pull request #331 from vishh/labels-annotations
Add annotations and labels to the Spec.
2016-03-09 11:15:53 -08:00
Rob Dolin (MSFT) 4288244a89 ReadMe: Update content to match print order
Update the Table of Contents section of the ReadMe.md to match the order
of the merged MarkDown files in the printable HTML and PDF outputs

Signed-off-by: Rob Dolin <RobDolin@microsoft.com>
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-03-09 14:12:59 -05:00
Vishnu kannan 1c49f4d21c Add annotations and labels to the Spec.
Signed-off-by: Vishnu kannan <vishnuk@google.com>
2016-03-09 11:11:28 -08:00
Michael Crosby 3b7c15d90f Merge pull request #334 from mrunalp/remove_state_dir
Remove the state directory as we now have a state operation instead
2016-03-08 10:39:30 -08:00
Mrunal Patel 16c09954b1 Remove the state directory as we now have a state operation instead
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2016-03-08 13:35:49 -05:00
Vincent Batts 5a606f4604 Merge pull request #333 from mrunalp/optional_seccomp
Seccomp should be optional
2016-03-08 12:48:49 -05:00
Mrunal Patel 36b0b18abf Seccomp should be optional
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2016-03-07 17:59:30 -08:00
Michael Crosby a1e32a8ead Merge pull request #330 from wking/process-security-indent
config: Fix indents for process.apparmorProfile and .selinuxLabel
2016-03-03 10:12:31 -08:00
W. Trevor King 6b639d2520 config: Fix indents for process.apparmorProfile and .selinuxLabel
These slipped through in 5a8a779f (Move process specific settings to
process, 2016-03-02, #329).

Signed-off-by: W. Trevor King <wking@tremily.us>
2016-03-02 14:35:24 -08:00
Vincent Batts 0c2892bf82 Merge pull request #329 from crosbymichael/process
Move process specific settings to process
2016-03-02 15:26:55 -05:00
Michael Crosby 5a8a779fb0 Move process specific settings to process
This moves process specific settings like caps, apparmor, and selinux
process label onto the process structure to allow the same settings to
be changed at exec time.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-03-02 11:40:09 -08:00
Mrunal Patel 95e12594fc Merge pull request #323 from hqhq/hq_fix_devices_example
Fix type of devices type
2016-02-29 09:47:05 -08:00