handle container deps removal with postsop hooks#1973
Conversation
|
I still have work to do here: Once the runtime deps ( This will result :
WDYT @containerd/nerdctl-maintainers |
|
@fahedouch SGTM! as long as runtime/oci provides such capabilities we should utilize them other than handling in nerdctl. Just a few questions (this is new to me :)):
Thanks |
|
I have a basic question. Does taskStart and task.kill call ocihooks? |
I believe that returned error error is handled by
not all deps can be handled by the ocihook, such as anon volume remove as it depends on cli options. So the idea is to start moving theses deps under oci hook scope:
No.
no changes for |
|
I have some blocker(s) to make oci hooks managing the container deps. I can't figure out what is creating |
found my answer, I was targeting the wrong path :p , what I am looking for is the creation of |
|
Unfortunately, I could not totally acheive my goal using runtime-spec oci hooks, for the simple reason that all hooks are triggered after the runtime environment has been created (according to the spec configuration in config.json): So these deps cannot be handled by runtime-spec oci hooks:
But container |
cdc8217 to
4b8f4ff
Compare
|
Hi @fahedouch; I am still building my understanding.
I am also curious what happens when nerdctl run -d <...> sleep infinity and exec is called together in it. I am guessing it works because the tests are passing. |
Hi @manugupt1 , you can verify this by checking the
|
7ce0bd8 to
0f03e9d
Compare
|
Thank you @fahedouch for this PR; I learnt quite a bit. |
8d2ff1c to
a0bf602
Compare
|
cc @AkihiroSuda PTAL! |
|
This change is relatively huge, so let me release v1.2.1 before merging this |
| isErr = true | ||
| } | ||
|
|
||
| } |
There was a problem hiding this comment.
The name has to be reserved as soon as the container is created, so this code shouldn't be moved
There was a problem hiding this comment.
@AkihiroSuda this code is for Releasing name and not reserving name. Why talking about reserving name here ?
There was a problem hiding this comment.
Sorry, my comment is for L690 if err := containerNameStore.Acquire(name, id); err != nil {
There was a problem hiding this comment.
The name has to be reserved as soon as the container is created, so this code shouldn't be moved
the above code shouldn't be removed too, as failed creation in this level need a cleanup too
222041b to
bdacd1e
Compare
6b40941 to
12813ea
Compare
|
@AkihiroSuda PTAL ! |
|
CI failing |
|
this introduce double acquire , so names |
a99cc58 to
5147e7c
Compare
Signed-off-by: fahed dorgaa <fahed.dorgaa@gmail.com>
e584f5f to
df08a17
Compare
|
@AkihiroSuda PTAL again plz |
#Before
the container deps (
etchosts files,names,container state) removal is deferred by RemoveContainer which means container deletion happens before deps deletion.#After
Using runtime-spec postStop Hook, we ensure that container deps deletion is successfully completed before the container deletion returns
Signed-off-by: fahed dorgaa fahed.dorgaa@gmail.com