-
Notifications
You must be signed in to change notification settings - Fork 2k
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
HostVolumePlugin interface and two implementations #24497
Conversation
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 once a few minor issues are resolved. Nice work on the plugin shell scripts!
@@ -501,6 +501,7 @@ func (v *HostVolume) deleteVolume(vol *structs.HostVolume) error { | |||
method := "ClientHostVolume.Delete" | |||
cReq := &cstructs.ClientHostVolumeDeleteRequest{ | |||
ID: vol.ID, | |||
PluginID: vol.PluginID, |
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 suspect that once we have state tracking on the client we can slim down this RPC and drop PluginID
and HostPath
, but obviously fine for now.
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.
might need Parameters too. I can conceive of plugins that use the params in a call to some other system, or who knows.
* mkdir: HostVolumePluginMkdir: just creates a directory * example-host-volume: HostVolumePluginExternal: mkfs and mount loopback
send json PARAMETERS env var instead
4c68674
to
5725da4
Compare
5725da4
to
a85f06f
Compare
@gulducat if you want to push testing into it's own PR that feels reasonable for a large PR on something so "side-effect-y" but we should probably add the package to the list in |
I've started writing tests, but I'm also happy to open another PR for it, so we can all collectively use this purportedly-functional thing in the meantime 😜 |
* mkdir: HostVolumePluginMkdir: just creates a directory * example-host-volume: HostVolumePluginExternal: plugin script that does mkfs and mount loopback Co-authored-by: Tim Gross <[email protected]>
* mkdir: HostVolumePluginMkdir: just creates a directory * example-host-volume: HostVolumePluginExternal: plugin script that does mkfs and mount loopback Co-authored-by: Tim Gross <[email protected]>
* mkdir: HostVolumePluginMkdir: just creates a directory * example-host-volume: HostVolumePluginExternal: plugin script that does mkfs and mount loopback Co-authored-by: Tim Gross <[email protected]>
* mkdir: HostVolumePluginMkdir: just creates a directory * example-host-volume: HostVolumePluginExternal: plugin script that does mkfs and mount loopback Co-authored-by: Tim Gross <[email protected]>
* mkdir: HostVolumePluginMkdir: just creates a directory * example-host-volume: HostVolumePluginExternal: plugin script that does mkfs and mount loopback Co-authored-by: Tim Gross <[email protected]>
Instead of a plugin `version` subcommand that responds with a string (established in #24497), respond to a `fingerprint` command with a data structure that we may extend in the future (such as plugin capabilities, like size constraint support?). In the immediate term, it's still just the version: `{"version": "0.0.1"}` In addition to leaving the door open for future expansion, I think it will also avoid false positives detecting executables that just happen to respond to a `version` command. This also reverses the ordering of the fingerprint string parts from `plugins.host_volume.version.mkdir` (which aligned with CNI) to `plugins.host_volume.mkdir.version` (makes more sense to me)
* mkdir: HostVolumePluginMkdir: just creates a directory * example-host-volume: HostVolumePluginExternal: plugin script that does mkfs and mount loopback Co-authored-by: Tim Gross <[email protected]>
Instead of a plugin `version` subcommand that responds with a string (established in #24497), respond to a `fingerprint` command with a data structure that we may extend in the future (such as plugin capabilities, like size constraint support?). In the immediate term, it's still just the version: `{"version": "0.0.1"}` In addition to leaving the door open for future expansion, I think it will also avoid false positives detecting executables that just happen to respond to a `version` command. This also reverses the ordering of the fingerprint string parts from `plugins.host_volume.version.mkdir` (which aligned with CNI) to `plugins.host_volume.mkdir.version` (makes more sense to me)
This is functional end-to-end from CLI to Client, provided you place the
example-host-volume
plugin script in/opt/nomad/hostvolumeplugins/
on the client node, or use the"mkdir"
internal plugin.I have not tried this on MacOS or Windows, only my Linux laptop. Perhaps @pkazmierczak can test it on Mac for us? 🙂
There are many TODOs around, and no unit tests are present. Testing what's here is up next on my todo list, provided the overall shape of the interface here looks good to y'all.
Ref: #24479
The
_test-plugin.sh
script was convenient for me sprucing up the example plugin, and gave me two ideas for future:nomad
CLI subcommand might be neat to include, to ease plugin development for users_
(or.
or something) for library files