-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
pod: fix duplicate volumes from containers.conf #19902
Conversation
If some volumes are specified in containers.conf, they are currently added twice to the containers spec causing the container to fail: $ head -n2 ~/.config/containers/containers.conf [containers] volumes = ["/tmp:/tmp"] $ podman pod create --name foo 7ac7f97f9b74a596332483e4a13e58cb9c8d997e9c5baae46804ae0acc26cbc6 $ podman run --pod=foo alpine true Error: "/tmp": duplicate mount destination The fix is to ignore the setting from containers.conf when setting the pod default configuration. Signed-off-by: Giuseppe Scrivano <[email protected]>
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: giuseppe 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 |
// these settings are not applicable to pod create since they are per-container | ||
// and they will end up being duplicated for each container in the pod. | ||
infraOptions.Volume = nil | ||
infraOptions.Mount = nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Barely on the fence here. Should we add a debug statement just above this, showing the values we're wiping? I think not, but I don't know for sure if that might be useful at some far-flung point in time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure, I can add that if you think it is useful
LGTM |
/lgtm I wonder if we shouldn't dedup mounts in SpecGen to try and catch things like this, I can see this also happening with |
I've tried that solution first, but we have different options for |
/hold cancel |
If some volumes are specified in containers.conf, they are currently added twice to the containers spec causing the container to fail:
$ head -n2 ~/.config/containers/containers.conf
[containers]
volumes = ["/tmp:/tmp"]
$ podman pod create --name foo
7ac7f97f9b74a596332483e4a13e58cb9c8d997e9c5baae46804ae0acc26cbc6 $ podman run --pod=foo alpine true
Error: "/tmp": duplicate mount destination
The fix is to ignore the setting from containers.conf when setting the pod default configuration.
Does this PR introduce a user-facing change?