-
Notifications
You must be signed in to change notification settings - Fork 347
Add image volume support. #241
Conversation
|
I've verified this PR, ownership and rw of the image volume is set properly now: # crictl --runtime-endpoint=/var/run/cri-containerd.sock exec -s 2545316f7d3ff883c80da6480833804d5bd0d463e2080e0777147e2fe4718f99 cat /proc/self/mountinfo | grep "data"
314 295 8:1 /var/lib/cri-containerd/sandboxes/dadf4bf511917af2a595d7d12356bdfabb620190c27f0e8ac67b65f7ae755d6c/hosts /etc/hosts ro,relatime - ext4 /dev/sda1 rw,data=ordered
315 295 8:1 /var/lib/cri-containerd/sandboxes/dadf4bf511917af2a595d7d12356bdfabb620190c27f0e8ac67b65f7ae755d6c/resolv.conf /etc/resolv.conf ro,relatime - ext4 /dev/sda1 rw,data=ordered
317 295 8:1 /var/lib/cri-containerd/containers/2545316f7d3ff883c80da6480833804d5bd0d463e2080e0777147e2fe4718f99/volumes/4281438d8117f1b6e33a10658d5e5290035c6a63dd68d6abe87bf97f3ec6b010 /data/configdb rw,relatime - ext4 /dev/sda1 rw,data=ordered
318 295 8:1 /var/lib/cri-containerd/containers/2545316f7d3ff883c80da6480833804d5bd0d463e2080e0777147e2fe4718f99/volumes/abe3b46973580e81795394a5067ad98717bf1d462b5eb42805e6c8b2558a09bf /data/db rw,relatime - ext4 /dev/sda1 rw,data=ordered
# crictl --runtime-endpoint=/var/run/cri-containerd.sock exec -s 2545316f7d3ff883c80da6480833804d5bd0d463e2080e0777147e2fe4718f99 ls -al /data
total 16
drwxr-xr-x 4 root root 4096 Sep 8 08:09 .
drwxr-xr-x 1 root root 4096 Sep 12 06:31 ..
drwxr-xr-x 2 mongodb mongodb 4096 Sep 12 06:31 configdb
drwxr-xr-x 2 mongodb mongodb 4096 Sep 12 06:31 db
|
f6c1061 to
2ec3ba2
Compare
I think we do, I found the sock-shop demo was relying on it (I think to preseed the database within the volume). |
| // Generate container runtime spec. | ||
| mounts := c.generateContainerMounts(getSandboxRootDir(c.rootDir, sandboxID), config) | ||
|
|
||
| spec, err := c.generateContainerSpec(id, sandboxPid, config, sandboxConfig, image.Config, append(mounts, volumeMounts...)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need to subtract from volumeMounts anything which is also expliclty in mounts, since an explicit bind mount is supposed to take precedence over the implicit ones.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW -- this would also mean that as soon as Kubelet starts to understand these things and provide them via mounts directly it will magically stop trying to do things here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need to subtract from volumeMounts anything which is also expliclty in mounts, since an explicit bind mount is supposed to take precedence over the implicit ones.
Done.
BTW -- this would also mean that as soon as Kubelet starts to understand these things and provide them via mounts directly it will magically stop trying to do things here.
We'll see how CRI will change in that case, and make change our side correspondingly. Added TODO for it.
Signed-off-by: Lantao Liu <lantaol@google.com>
2ec3ba2 to
3e2e913
Compare
I'll do this in another PR. For this PR, I'll only copy the ownership, and see how things going. |
ijc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
It seems like I was mistaken -- I just fired up sock-shop with this PR and everything looked to be working ok. I was unable to login with any of the preseeded accounts but I made a quick patch to add copy up and it didn't seem to make a difference to that functionality. In any case I was able to manually add a new account. |
|
Apply LGTM based on #241 (review). Will merge after test passes. |
For the The failed lstat appears to be from |
|
I fixed the tests carried this in #247. |
Sorry to flip-flop on this, but I tested with docker as the engine and I could login, so the issue here was that my copy-up prototype was somehow incomplete or wrong. I'm looking into why now, but we can move ahead with this PR/#247 in the meantime I think. |
No wonder. :p |
|
@ijc I'll review and merge your PR instead. |
|
Close this one, because this has been included in #247. |
For image volume, currently we only:
What we are going to do in the future:
@ijc
Signed-off-by: Lantao Liu lantaol@google.com