Skip to content

Commit caa7fce

Browse files
committed
hooks: start with pre-start and post-stop hooks.
Signed-off-by: Mrunal Patel <[email protected]>
1 parent 25e30fe commit caa7fce

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

runtime.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,27 @@ Runs a process in a container. Can be invoked several times.
1515
Not sure we need that from oc cli. Process is killed from the outside.
1616

1717
This event needs to be captured by oc to run onstop event handlers.
18+
19+
## Hooks
20+
Hooks allows one to run code before/after various lifecycle events of the container. The state of the container is passed to the hooks over a well-known fd, so the hooks could get the information they need to do their work.
21+
22+
Hooks are placed under a well known directories under which they are search for and executed. The list of directories that will be looked up are:
23+
24+
```
25+
/run/ocf/hooks
26+
/usr/lib/ocf/hooks
27+
```
28+
29+
### Pre-start
30+
The pre-start hook is called after the container process is started but before the user supplied command is execed. It provides an opportunity to customize the container. In Linux, for e.g., the network namespace could be configured in this hook.
31+
32+
### Post-stop
33+
The post-stop hook is called after the container process is stopped. Cleanup or debugging could be performed in such a hook.
34+
35+
```
36+
"hooks" : {
37+
"pre-start": ["pre-start-hook", "arg1", "arg2"],
38+
"post-stop": ["post-stop-hook", "arg1"]
39+
}
40+
```
41+

0 commit comments

Comments
 (0)