Commit graph

6 commits

Author SHA1 Message Date
W. Trevor King
0b08c8437c hooks: Example copy-edits (backticks, etc.)
Also move the English before the example, because folks reading this
documentation already speak English and are just learning the JSON
structure.

The 'console' syntax highlighting is because GitHub uses Linguist [1],
and Linguist recognizes 'console' as an alias for ShellSession [2].
I've chosen 'console' because it's shorter than 'ShellSession' and not
interpreter-specific like 'bash session'.

Dan requested the 'Kpod' -> 'podman' change [3].

[1]: https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting
[2]: https://github.com/github/linguist/blob/v6.0.1/lib/linguist/languages.yml#L4289-L4300
[3]: https://github.com/kubernetes-incubator/cri-o/pull/1355#pullrequestreview-98250057

Signed-off-by: W. Trevor King <wking@tremily.us>
2018-03-01 09:14:28 -08:00
W. Trevor King
c80cdedbee hooks: Use RFC 2119 for the hook configuration specification
Make this more like the runtime spec, using the RFC 2119 keywords for
both JSON-author and CRI-O requirements.  This also clarifies the
regular expression language (POSIX EREs), links to a JSON spec, and
tightens wording for the various matching criteria.

I think the hook-config format could be improved (versioning it, and
reusing the runtime-spec hook structure instead of renaming 'path' to
'hook', dropping 'timeout', etc.).  But I'm leaving that sort of thing
to future work.

Signed-off-by: W. Trevor King <wking@tremily.us>
2018-02-20 15:02:54 -08:00
W. Trevor King
72afb41544 hooks: Punt hook documentation to the runtime spec
No need to repeat the specification here, just link to the version we
generate.

Signed-off-by: W. Trevor King <wking@tremily.us>
2018-02-20 15:02:54 -08:00
W. Trevor King
37f136562b hooks: Remove backticks from CRI-O
These backticks landed with the rest of the hook docs in 139d0841 (Add
support for oci-hooks to libkpod, 2017-08-12, #562).  But "CRI-O" is
the project name, so it doesn't need backticks.  We would need
backticks if we used the executable filename "crio".

Signed-off-by: W. Trevor King <wking@tremily.us>
2018-02-20 10:21:53 -08:00
Daniel J Walsh
23d20c9db5 Allow additional arguments to be passed into hooks
If a packager wants to be able to support addititional arguments on his
hook this will allow them to setup the configuration with these arguments.

For example this would allow a hook developer to add support for a --debug
flag to change the level of debugging in his hook.

In order to complete this task, I had to vendor in the latest
github.com://opencontainers/runtime-tools, which caused me to have to fix a
Mount and Capability interface calls

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-01-09 13:44:16 -05:00
Daniel J Walsh
139d0841e8 Add support for oci-hooks to libkpod
Add new directory /etc/crio/hooks.d, where packagers can drop a json config
file to specify a hook.

The json must specify a valid executable to run.
The json must also specify which stage(s) to run the hook:
prestart, poststart, poststop
The json must specify under which criteria the hook should be launched
If the container HasBindMounts
If the container cmd matches a list of regular expressions
If the containers annotations matches a list of regular expressions.
If any of these match the the hook will be launched.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-09-05 07:39:31 -04:00