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

[CSI] Prevent stage_publish_base_dir from being subdir of mount_dir #19441

Merged
merged 3 commits into from
Dec 13, 2023

Conversation

ggriffiths
Copy link
Contributor

Fixes #19440

@ggriffiths
Copy link
Contributor Author

@tgross can you take a look?

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.

Hi @ggriffiths! Thanks for the PR!

In addition to addressing the comments I've posted, can you run make cl to add a changelog entry for the fix once you're done?

jobspec/parse_task.go Outdated Show resolved Hide resolved
website/content/docs/job-specification/csi_plugin.mdx Outdated Show resolved Hide resolved
@@ -7942,6 +7942,11 @@ func (t *Task) Validate(jobType string, tg *TaskGroup) error {
mErr.Errors = append(mErr.Errors, fmt.Errorf("CSIPluginConfig PluginType must be one of 'node', 'controller', or 'monolith', got: \"%s\"", t.CSIPluginConfig.Type))
}

if t.CSIPluginConfig.StagePublishBaseDir != "" && t.CSIPluginConfig.MountDir != "" &&
strings.HasPrefix(t.CSIPluginConfig.StagePublishBaseDir, t.CSIPluginConfig.MountDir) {
Copy link
Contributor Author

@ggriffiths ggriffiths Dec 12, 2023

Choose a reason for hiding this comment

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

I think this will handle most cases. For example, if stage_publish_base_dir=/local/csi and mount_dir=/local, then we'll error out.

However, we don't error out if stage_publish_base_dir=/csi and mount_dir=/local/csi

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.

This looks great @ggriffiths. Just the two minor suggestions left to accept and I think we can merge this.

.changelog/19441.txt Outdated Show resolved Hide resolved
@ggriffiths
Copy link
Contributor Author

Sounds good. Thanks for the quick review @tgross

@ggriffiths ggriffiths requested a review from tgross December 13, 2023 19:12
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/1.5.x backport to 1.5.x release line backport/1.6.x backport to 1.6.x release line backport/1.7.x backport to 1.7.x release line theme/storage type/bug
Projects
Development

Successfully merging this pull request may close these issues.

[CSI] Do not allow stage_publish_base_dir to be a sub-directory of mount_dir
2 participants