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

Overlay mounts supersede image volumes & volumes-from #24565

Merged
merged 1 commit into from
Nov 19, 2024

Conversation

mheon
Copy link
Member

@mheon mheon commented Nov 14, 2024

This matches the behavior of other volume and mount types. Image volumes and volumes/mounts from the --volumes-from flag should be overridden by actual user-specified named volumes and mounts, but this was not true for overlay mounts. Fortunately, our duplicate-mount detection logic still works, so we got a good error message at least.

The fix is simple - extend our supersede logic, which currently only works with named volumes and mounts, to also work with overlay mounts.

Fixes #24555

Does this PR introduce a user-facing change?

Fixed a bug where overlay mounts could not be made at paths where the image specifies a volume ([#24555](https://github.com/containers/podman/issues/24555)).

@openshift-ci openshift-ci bot added release-note approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Nov 14, 2024
@@ -1089,4 +1089,20 @@ RUN chmod 755 /test1 /test2 /test3`, ALPINE)
Expect(checkCtr.OutputToString()).To(ContainSubstring("foo"))
Expect(checkCtr.OutputToString()).To(ContainSubstring("bar"))
})

It("user-specified overlay supersedes image volume", func() {
err = podmanTest.RestoreArtifact(REDIS_IMAGE)
Copy link
Member

Choose a reason for hiding this comment

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

is the restore actually needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

We need something with an image volume, Redis has an image volume, and the other tests in the file use it.

I can probably convert over to nginx which I think is cached?

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually nginx does not have an image volume, I was misremembering.
I could build an image locally based on alpine with a volume but I don't know if that's any faster.

for dest := range baseMounts {
if _, ok := baseVolumes[dest]; ok {
return nil, nil, nil, fmt.Errorf("baseMounts conflict at mount destination %v: %w", dest, specgen.ErrDuplicateDest)
}
if _, ok := unifiedOverlays[dest]; ok {
return nil, nil, nil, fmt.Errorf("baseMounts conflict with overlay mount at mount destination %v: %w", dest, specgen.ErrDuplicateDest)
Copy link
Member

Choose a reason for hiding this comment

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

I don't quite follow the code, how would one trigger this error condition? Can we test that?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, easily. podman run -v myvol:/test -v /my-overlay-mount:/test:O .... I'll add it.

This matches the behavior of other volume and mount types. Image
volumes and volumes/mounts from the `--volumes-from` flag should
be overridden by actual user-specified named volumes and mounts,
but this was not true for overlay mounts. Fortunately, our
duplicate-mount detection logic still works, so we got a good
error message at least.

The fix is simple - extend our supersede logic, which currently
only works with named volumes and mounts, to also work with
overlay mounts.

Fixes containers#24555

Signed-off-by: Matt Heon <[email protected]>
@mheon
Copy link
Member Author

mheon commented Nov 15, 2024

One flake, looked network related, green otherwise. @containers/podman-maintainers PTAL

Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

openshift-ci bot commented Nov 15, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Luap99, mheon

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

The pull request process is described 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

@baude
Copy link
Member

baude commented Nov 19, 2024

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Nov 19, 2024
@baude
Copy link
Member

baude commented Nov 19, 2024

/cherry-pick v5.3

@openshift-cherrypick-robot
Copy link
Collaborator

@baude: once the present PR merges, I will cherry-pick it on top of v5.3 in a new PR and assign it to you.

In response to this:

/cherry-pick v5.3

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-sigs/prow repository.

@openshift-merge-bot openshift-merge-bot bot merged commit 183cf98 into containers:main Nov 19, 2024
77 of 78 checks passed
@openshift-cherrypick-robot
Copy link
Collaborator

@baude: #24565 failed to apply on top of branch "v5.3":

Applying: Overlay mounts supersede image volumes & volumes-from
Using index info to reconstruct a base tree...
M	test/e2e/run_volume_test.go
Falling back to patching base and 3-way merge...
Auto-merging test/e2e/run_volume_test.go
CONFLICT (content): Merge conflict in test/e2e/run_volume_test.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config advice.mergeConflict false"
Patch failed at 0001 Overlay mounts supersede image volumes & volumes-from

In response to this:

/cherry-pick v5.3

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-sigs/prow repository.

@stale-locking-app stale-locking-app bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Feb 18, 2025
@stale-locking-app stale-locking-app bot locked as resolved and limited conversation to collaborators Feb 18, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot overlay mount an existing volume
4 participants