patch for pod host networking & other host namespace handling

this patch included additonal host namespace checks when creating a ctr as well
as fixing of the tests to check /proc/self/ns/net

see #14461

Signed-off-by: cdoern <cdoern@redhat.com>
This commit is contained in:
cdoern
2022-06-03 11:01:22 -04:00
parent 0dda468192
commit b13fc1bf98
4 changed files with 44 additions and 36 deletions

View File

@@ -130,14 +130,24 @@ var _ = Describe("Podman pod create", func() {
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "-dt", "--pod", session.OutputToString(), ALPINE})
session = podmanTest.Podman([]string{"run", "--name", "hostCtr", "--pod", session.OutputToString(), ALPINE, "readlink", "/proc/self/ns/net"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"inspect", "--format", "'{{.NetworkSettings.SandboxKey}}'", session.OutputToString()})
ns := SystemExec("readlink", []string{"/proc/self/ns/net"})
ns.WaitWithDefaultTimeout()
Expect(ns).Should(Exit(0))
netns := ns.OutputToString()
Expect(netns).ToNot(BeEmpty())
Expect(session.OutputToString()).To(Equal(netns))
// Sanity Check for podman inspect
session = podmanTest.Podman([]string{"inspect", "--format", "'{{.NetworkSettings.SandboxKey}}'", "hostCtr"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session.OutputToString()).Should(ContainSubstring("''")) // no network path... host
Expect(session.OutputToString()).Should(Equal("''")) // no network path... host
})
It("podman pod correctly sets up IPCNS", func() {