-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Podman does not support the mount propagation needed by CSI plugins #192
Comments
I think I am seeing the same issue when using the JuiceFS CNI plugin. https://juicefs.com/docs/csi/csi-in-nomad/ Binds on the JuiceFS CSI Node job:
Inside the JuiceFS node container you can it is mounting correctly.
But in the task it has the bind mount:
which writes files to the allocation directory and not into the CSI volume mount:
And the JuiceFS CSI plugin doesn't think things are mounted correctly:
@ejweber if you take a crack at adding what is needed to make this work, I would be down to help you test it. @tgross what do you think? |
Yeah, this sounds like a reasonable approach to me. As far Podman on non-Linux goes, it looks like they're intending to run only on Linux, using a VM on macOS/Windows. See https://podman.io/getting-started/installation.html#installing-on-mac--windows And I don't see any suggestion in their GitHub issues that the developers (mostly RedHat) intend to do otherwise. So I don't think we'll need OS-specific logic there. |
I was able to get things working with the following hack:
|
It's good to see that works, @jdoss. I was hoping to do something a bit more flexible, so I tried the following: d.logger.Info("in containerMounts", "propagationMode", m.PropagationMode)
switch m.PropagationMode {
case nstructs.VolumeMountPropagationPrivate:
bind.Options = append(bind.Options, "rprivate")
case nstructs.VolumeMountPropagationHostToTask:
bind.Options = append(bind.Options, "rslave")
case nstructs.VolumeMountPropagationBidirectional:
bind.Options = append(bind.Options, "rshared")
// If PropagationMode is something else or unset, Podman defaults to rprivate
} Unfortunately, it isn't working. The reason is that PropagationMode is coming in empty (confirmed by the log line I added). I also added a log statement at the top of StartTask to see exactly what I'm dealing with. I get the following in the taskConfig:
This looks completely consistent with what I expect from the CSI Plugin Prestart Hook, except with PropagationMode empty where I expect it to be "bidirectional". I have been trying to understand where in the Nomad plugin infrastructure we might be dropping the PropagationMode, but I'm at a bit of a loss. |
Sorry about the delay there, it's been a busy last few weeks. I've assigned myself this issue so that I remember to keep coming back to it. I traced where the propagation mode is being set in the driver all the way up to I looked at the Nomad side of things and it looks like we're reading the mounts set by the hook correctly for the I thought I'd found a spot in the |
hashicorp/nomad#15014 just got opened pointing out we're missing the spot needed to serialize the mount propagation entirely. So that explains that. |
Good find @tgross! I imagine the fix I wrote for the Podman driver will "just work" once that one is handled. I'll hold off submitting a PR for this issue until that one is resolved and I can test against it (though no hard feelings if someone else beats me to it 😄). |
@ejweber #15096 is now merged and will go out in our next Nomad release. If you want to test your changes before then you can pull the latest code from |
Looks like hashicorp/nomad#15096 was just released in Nomad 1.4.3. @ejweber can you push up your PR when you get a chance? |
Sorry all. I didn't get to testing while the code was sitting out there on main, but I did have an opportunity to play with it this afternoon (using the released Nomad v1.4.3). The changes from hashicorp/nomad#15096 plus my new PR (#204) yield the following:
Note the |
Hi ! I'm facing the same issue with democratic-csi. I'm sure your fix will be the solution to my similar issue, but I don't now where I should put the bind mount propagation? Is it in the Since Thank you for your help and your fixes |
Hello @quentin9696, You shouldn't have to do anything at all to make use of these changes. Nomad itself requests certain bind mounts for CSI driver tasks and the combined changes made by @tgross, @lgfa29, and I ensure that these bind mounts are set up with appropriate propagation in a Podman orchestrated container. Assuming the bind mounts Nomad sets up are sufficient for your driver operation (and I think they will be for most use cases), you should be good to go. One big caveat is versioning. It looks like my changes haven't made it into a released version of nomad-driver-podman yet, so you still have to build it from source off main and deploy it to your Nomad nodes for them to take effect. Hopefully a new version of the task driver is spun sometime soon, but, to be honest, I'm not that familiar with the release process. You also need to make sure you're using at least Nomad version 1.4.3. |
Hi @ejweber, Yes I finally found my reply, I just need to setup my bind mount with this: volume_mount {
volume = "test"
destination = "/srv"
read_only = false
propagation_mode = "bidirectional"
} after upgrading my nomad to 1.4.3 and my plugin to the snapshot version. I think there is some lack of documentation on this plugin, as well as on nomad docker because there is no mention of the |
Oh you are right @quentin9696, that parameter is missing from the docs, I've opened hashicorp/nomad#15785 to update it. Please note the warning about |
Also thank you for the reply @ejweber. I will see if we can cut a release in the coming days. There are a few open PRs that we need to take care of. |
My mistake @quentin9696. I assumed you were only looking to have the default bind mounts created for a CSI driver task assigned bidirectional mount propagation (as opposed to a custom bind mount you need). Thanks for the documentation @lgfa29. |
In #169 @tgross added the ability for the Podman driver to bind mounts from a TaskConfig. While this didn't allow the addition of a mount block using the external API (that's left to do in #142), it did allow Podman to set up the bind mounts requested by the CSI Plugin Prestart Hook, enabling Podman driver CSI support.
As we were experimenting with this functionality for the BeeGFS CSI driver, we noticed that our driver container seemed unable to see volumes it had already mounted. In NodeUnpublishVolume and NodeUnstageVolume, this manifested itself as a bunch of errors wherein Nomad would tell the driver to unstage but the driver insisted there was no mount to operate on. An inspection of the driver container shows the following:
There's a lot there, but the important bit is that
/opt/nomad/client/csi/node/beegfs-csi-plugin
is bind mounted to/opt/nomad/client/csi/node/beegfs-csi-plugin
as rprivate (this would be/opt/nomad/client/csi/node/beegfs-csi-plugin
to/local/csi
for most plugins, but this is just a BeeGFS CSI driver implementation detail). The CSI Plugin Prestart Hook wants this to be a bidirectional mount (rshared), but the changes in #169 don't take PropagationMode into account. Unless it the bind has rshare, it's not clear how most CSI drivers would be able to propagate the mounts they create inside their containers to Nomad tasks.I think a fix for this would be as easy as adding a conversion like the Docker driver already does, but the Docker driver has some extra logic in it that gives me a bit of pause (can the Podman driver run on Windows?).
I can probably find some time to make a quick change and do some sanity checking, but am I thinking about this issue correctly?
The text was updated successfully, but these errors were encountered: