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

Add missing user-facing part to allow volume subpath mounts #22040

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

basilgello
Copy link

Add missing user-facing "subpath" option to mount subpaths of named volumes.

Does this PR introduce a user-facing change?

Yes, adding "subpath" as valid mount and volume option in podman-container-create(1), podman-run(1).

Allow users to mount subpaths of named volumes via 'subpath' mount option.

The code enabling volume subpath mounts has been merged in
containers#17992 but no user-facing change was made.
The documentation was also not updated.

Signed-off-by: Vasyl Gello <[email protected]>
Copy link
Contributor

openshift-ci bot commented Mar 14, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: basilgello
Once this PR has been reviewed and has the lgtm label, please assign rhatdan for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@basilgello
Copy link
Author

After #17992 was merged, I had to add only user-facing change to fix #20661

This is a squashed commit with vendors in for easier review, I will split the relevant commits into proper PRs once I get general ACK.

@@ -371,6 +371,19 @@ func parseMountOptions(mountType string, args []string) (*spec.Mount, error) {
return nil, fmt.Errorf("host directory cannot be empty: %w", errOptionArg)
}
mnt.Source = value
case "subpath":
if setSubpath {
return nil, fmt.Errorf("cannot pass 'subpath' option more than once: %w", errOptionArg)
Copy link
Member

Choose a reason for hiding this comment

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

nit: This error should use %q and name like the one just below.

Copy link

Cockpit tests failed for commit dcf9daed49d7abce3a3fdf74668c387ecf49d965. @martinpitt, @jelly, @mvollmer please check.

Copy link

Cockpit tests failed for commit dc75dfbf2b7b26b704af11fad36e8722094b966c. @martinpitt, @jelly, @mvollmer please check.

@basilgello
Copy link
Author

@giuseppe you mentioned the security implications of this features in the linked issue. I think 17992 solved them, so please review.

@@ -14,7 +14,7 @@ import (

// ValidateVolumeOpts validates a volume's options
func ValidateVolumeOpts(options []string) ([]string, error) {
var foundRootPropagation, foundRWRO, foundLabelChange, bindType, foundExec, foundDev, foundSuid, foundChown, foundUpperDir, foundWorkDir, foundCopy, foundCopySymlink int
var foundRootPropagation, foundRWRO, foundLabelChange, bindType, foundExec, foundDev, foundSuid, foundChown, foundUpperDir, foundWorkDir, foundCopy, foundCopySymlink, foundVolumeSubpath int
Copy link
Member

Choose a reason for hiding this comment

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

these changes must go in the https://github.com/containers/common project and then revendor them

Copy link
Author

Choose a reason for hiding this comment

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

I understand that, but I need some details.

Is the correct procedure here as follows?

  • Move this commit into separate PR in containers/common
  • Wait for it to be merged
  • go get -u github.com/containers/common && go mod vendor in this PR
  • Rebase this PR with new go.{mod,sum} and vendor

Copy link
Member

Choose a reason for hiding this comment

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

yes that is correct

Copy link
Author

Choose a reason for hiding this comment

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

@giuseppe bump?

Copy link
Member

Choose a reason for hiding this comment

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

sorry, forgot to submit the review.

@giuseppe
Copy link
Member

@giuseppe you mentioned the security implications of this features in the linked issue. I think 17992 solved them, so please review.

yes, these are solved with #17992

@basilgello basilgello force-pushed the subpaths-main branch 5 times, most recently from 6b07be0 to efcefef Compare March 16, 2024 07:13
Copy link

Cockpit tests failed for commit f85ce21fec0ab218e7732968dab92975f8448021. @martinpitt, @jelly, @mvollmer please check.

Copy link

Cockpit tests failed for commit 9b0c13633f7a91bf686aaa40f049127167180d15. @martinpitt, @jelly, @mvollmer please check.

Copy link

Cockpit tests failed for commit 9beab8b153142b87108b408c66d1f24df9f26df2. @martinpitt, @jelly, @mvollmer please check.

Copy link

Cockpit tests failed for commit 6b07be0767af417279a8077a797a8271aa00d12b. @martinpitt, @jelly, @mvollmer please check.

Copy link

Cockpit tests failed for commit efcefefa05dc3860d115b2c3602482ee9c76a704. @martinpitt, @jelly, @mvollmer please check.

Copy link

Cockpit tests failed for commit 6bbfcae. @martinpitt, @jelly, @mvollmer please check.

@larsks
Copy link
Contributor

larsks commented Apr 6, 2024

Docker has implemented this feature using the volume-subpath mount option (see pr 45687, landed on 19-jan-2024). This is available now in Docker v26.0.0.

It's probably worth updating this pr to adopt the same option names so that the cli and api are compatible.

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 29, 2024
@openshift-merge-robot
Copy link
Collaborator

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@mheon
Copy link
Member

mheon commented May 6, 2024

@basilgello Poke - are you still working on this? If not, we may take over to push this over the finish line

@basilgello
Copy link
Author

Let me spliy the PR tomorrow morning @mheon Should we follow up Docker convention as larsks mentioned or the current syntax is fine?

@basilgello
Copy link
Author

Also I postponded the split because I expected to get primary ACK from @giuseppe or other code owner but I did not get it to the date + several other issues on my side.

@mheon
Copy link
Member

mheon commented May 6, 2024

Docker convention would be preferred.

Sorry for the sudden attention, we're starting to prep for Podman 5.1 and this came up as something that could get in.

@basilgello
Copy link
Author

basilgello commented May 6, 2024

It is OK and I needed that nudge :) I will do the split and link the derived PRs to this one.

I am using this PR in https://salsa.debian.org/neurodebian-team/neurodebian-bot for 2 months.

@basilgello
Copy link
Author

@mheon I need your help :) In #22410 you added subpath option to image mounts. But Docker chose to name subpath option as volume-subpath (as larsks mentioned, just the wrong PR) Now if I change the user-facing option name for volume and mount to Docker's one, should I also rename the image mount option and its docs?

AFAIK the merged code is still in dev branch so I think it is better to rename all user-facing subpath option name to volume-subpath. WDYT?

@mheon
Copy link
Member

mheon commented May 8, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants