ref: Select the rootfs in the create step instead of Exec#817
Conversation
Move the chooseRootfs function from reexec to the create process. In this way we can perform the `preSetup` function of a block based rootfs before creating any namespace. This was a block for the adoption of libcontainers, because when we use libcontainers for the monitor execution environment, we will not be able to perform such operations like the `preSetup` step. This will also allow us to immediately unmount the rootfs created by containerd before creating any mount namespaces and having troubles with mount events and their propagation. Signed-off-by: Charalampos Mainas <cmainas@nubificus.co.uk>
When we read the annotations directly from the container spec, then these annotations are not base64 decoded and hence we should not use the `tryDecode` function to print them in the debug logs. Signed-off-by: Charalampos Mainas <cmainas@nubificus.co.uk>
✅ Deploy Preview for urunc canceled.
|
8e29191 to
c0586fd
Compare
3285315 to
fede36b
Compare
|
thanks @cmainas! LGTM!
|
Since we perform the rootfs selection in `urunc create`, the shim will fail to redo the same operation, because in case of block-based rootfs, the rootfs will get unmounted. Signed-off-by: Charalampos Mainas <cmainas@nubificus.co.uk>
fede36b to
2ef715f
Compare
|
Hello @ananos , thank you for the review:
Yes, that comment will be helpful. I have added it.
In the case of block-based rootfs, this PR unmounts the host mounted rootfs and therefore there is no need to change or adjust the propagation flags of the rootfs monut, since it does not exist anymore and hence it does not get inherited from the mount namespace of the container. Unfortunately, we still had issues even altering the propagation flags, since it only affects mount events under the mount point and not for the exact mount point.
This had to be replaced for long time. The annotations we set in the OCI image and the ones passed at runtime (runtime annotations) are not base64 encoded. Only the
I am not sure I understand this question. If you mean that the |
Description
Move the
chooseRootfsfunction from reexec to the create process. In this way we can perform thepreSetupfunction of a block based rootfs before creating any namespace. This was a block for the adoption of libcontainers, because when we use libcontainers for the monitor execution environment, we will not be able to perform such operations like thepreSetupstep.This will also allow us to immediately unmount the rootfs created by containerd before creating any mount namespaces and having troubles with mount events and their propagation.
Furthermore, since
chooseRootfstakes place inurunc create, we need to disable the same operation from the shim which takes place afterurunc createfinishes and therefore it might fail since in block-based rootfs the rootfs will get unmounted. However, this is a temporary solution and related to #816. The rootfs handling needs better control from the create task of the shim and hence we need to get deeper in the shim for a proper solution.At last, give this opportunity, remove the
tryDecodefunction from printing the annotations when we get them from the Spec.Related issues
How was this tested?
Running the e2e tests
LLM usage
N/A
Checklist
make lint).make test_ctr,make test_nerdctl,make test_docker,make test_crictl).