Skip to content
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

dynamic host volumes: change env vars, fixup auto-delete #24943

Merged
merged 6 commits into from
Jan 27, 2025

Conversation

gulducat
Copy link
Member

This trues up plugin behavior with the spec that we arrived at in the docs PR: #24924

  • Bugfix: Only automatically run delete when saving client state fails after initial create, not update or restore.
  • Only the operation (fingerprint/create/delete) is passed in as a positional argument. Everything else are environment variables.
  • Remove DHV_HOST_PATH env, where we included the volume ID within alloc_mounts, in favor of:
    • DHV_VOLUMES_DIR - create and delete - configurable - where plugins should place volumes, with whatever convention they like.
    • DHV_CREATED_PATH - delete - the "path" response from create; plugins may use this verbatim, or derive the path the same way as create
  • Add DHV_NAMESPACE and DHV_NODE_POOL to create and delete

I confirmed that the e2e test still passes - it only uses mkdir at the moment.

$ go test ./e2e/dynamic_host_volumes/
ok      github.com/hashicorp/nomad/e2e/dynamic_host_volumes     18.662s

I have not confirmed that the example plugin still works on MacOS.

@gulducat gulducat requested review from a team as code owners January 24, 2025 20:37
@gulducat gulducat requested review from prestonbourne and removed request for prestonbourne January 24, 2025 20:37
@gulducat gulducat added this to the 1.10.0 milestone Jan 24, 2025
nomad/host_volume_endpoint.go Outdated Show resolved Hide resolved
nomad/host_volume_endpoint.go Outdated Show resolved Hide resolved
client/hostvolumemanager/host_volumes.go Outdated Show resolved Hide resolved
// GetHostVolumePluginVersions finds all the executable files on disk that
// respond to a `fingerprint` call. The return map's keys are plugin IDs,
// and the values are version strings.
func GetHostVolumePluginVersions(log hclog.Logger, pluginDir, nodePool string) (map[string]string, error) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nodepool isn't really needed in this context, because fingerprint calls don't include it, but I pass it through here anyway to avoid potential confusion in the future if someone does want to add it to fingerprint env.

Copy link
Member

@tgross tgross left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@gulducat gulducat merged commit 49c147b into main Jan 27, 2025
32 checks passed
@gulducat gulducat deleted the dhv-plugins-true-to-docs branch January 27, 2025 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants