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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot overlay mount an existing volume
2 participants