-
Notifications
You must be signed in to change notification settings - Fork 3.1k
[v4.4.1-rhel] do not pass volume-opt as bind mounts options to runtime #28450
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
base: v4.4.1-rhel
Are you sure you want to change the base?
Changes from all commits
0ae642f
1ea0979
a9ac512
955e7f5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,20 @@ | ||
| package integration | ||
|
|
||
| import ( | ||
| "encoding/json" | ||
| "fmt" | ||
| "os" | ||
| "os/exec" | ||
| "os/user" | ||
| "path/filepath" | ||
| "strconv" | ||
| "strings" | ||
|
|
||
| . "github.com/containers/podman/v4/test/utils" | ||
| . "github.com/onsi/ginkgo" | ||
| . "github.com/onsi/gomega" | ||
| . "github.com/onsi/gomega/gexec" | ||
| "github.com/opencontainers/runtime-spec/specs-go" | ||
| ) | ||
|
|
||
| // in-container mount point: using a path that is definitely not present | ||
|
|
@@ -451,9 +454,27 @@ var _ = Describe("Podman run with volumes", func() { | |
| Expect(separateVolumeSession).Should(Exit(0)) | ||
| Expect(separateVolumeSession.OutputToString()).To(Equal(baselineOutput)) | ||
|
|
||
| copySession := podmanTest.Podman([]string{"run", "--rm", "-v", "testvol3:/etc/apk:copy", ALPINE, "stat", "-c", "%h", "/etc/apk/arch"}) | ||
| copySession.WaitWithDefaultTimeout() | ||
| Expect(copySession).Should(Exit(0)) | ||
| podmanTest.PodmanExitCleanly("run", "--name", "testctr", "-v", "testvol3:/etc/apk:copy", ALPINE, "stat", "-c", "%h", "/etc/apk/arch") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PodmanExitCleanly doesn't exist on this branch yet, so we gotta revert to the old way or backport PodmanExitCleanly changes too.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll take a look, thanks for the pointer. |
||
|
|
||
| inspect := podmanTest.PodmanExitCleanly("container", "inspect", "testctr", "--format", "{{.OCIConfigPath}}") | ||
|
|
||
| // Make extra check that the OCI config does not contain the copy opt, runc 1.3.0 fails on that while crun does not. | ||
| // We only test crun upstream so make sure the spec is sane: https://github.com/containers/podman/issues/26938 | ||
| f, err := os.Open(inspect.OutputToString()) | ||
| Expect(err).ToNot(HaveOccurred()) | ||
| defer f.Close() | ||
| var spec specs.Spec | ||
| err = json.NewDecoder(f).Decode(&spec) | ||
| Expect(err).ToNot(HaveOccurred()) | ||
|
|
||
| found := false | ||
| for _, m := range spec.Mounts { | ||
| if m.Destination == "/etc/apk" { | ||
| found = true | ||
| Expect(m.Options).To(Equal([]string{"rprivate", "nosuid", "nodev", "rbind"})) | ||
| } | ||
| } | ||
| Expect(found).To(BeTrue(), "OCI spec contains /etc/apk mount") | ||
|
|
||
| noCopySession := podmanTest.Podman([]string{"run", "--rm", "-v", "testvol4:/etc/apk:nocopy", ALPINE, "stat", "-c", "%h", "/etc/apk/arch"}) | ||
| noCopySession.WaitWithDefaultTimeout() | ||
|
|
@@ -875,14 +896,18 @@ VOLUME /test/`, ALPINE) | |
| It("podman run with --mount and named volume with driver-opts", func() { | ||
| // anonymous volume mount with driver opts | ||
| vol := "type=volume,source=test_vol,dst=/test,volume-opt=type=tmpfs,volume-opt=device=tmpfs,volume-opt=o=nodev" | ||
| session := podmanTest.Podman([]string{"run", "--rm", "--mount", vol, ALPINE, "echo", "hello"}) | ||
| session.WaitWithDefaultTimeout() | ||
| Expect(session).Should(Exit(0)) | ||
|
|
||
| inspectVol := podmanTest.Podman([]string{"volume", "inspect", "test_vol"}) | ||
| inspectVol.WaitWithDefaultTimeout() | ||
| Expect(inspectVol).Should(Exit(0)) | ||
| Expect(inspectVol.OutputToString()).To(ContainSubstring("nodev")) | ||
| // Loop twice to cover both the initial code path that creates the volume and the ones which reuses it. | ||
| for i := range 2 { | ||
| name := "testctr" + strconv.Itoa(i) | ||
| podmanTest.PodmanExitCleanly("run", "--name", name, "--mount", vol, ALPINE, "echo", "hello") | ||
|
|
||
| inspectVol := podmanTest.PodmanExitCleanly("volume", "inspect", "test_vol") | ||
| Expect(inspectVol.OutputToString()).To(ContainSubstring("nodev")) | ||
|
|
||
| inspect := podmanTest.PodmanExitCleanly("container", "inspect", name, "--format", "{{range .Mounts}}{{.Options}}{{end}}") | ||
| Expect(inspect.OutputToString()).To(ContainSubstring("[nosuid nodev rbind]")) | ||
| } | ||
| }) | ||
|
|
||
| It("volume permissions after run", func() { | ||
|
|
||
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.
@TomSweeneyRedHat remove this line too. This is not present on ginkgo v1. Sorry should've pointed that out earlier.