mirror of
https://github.com/containers/podman.git
synced 2025-06-21 09:28:09 +08:00
Merge pull request #14461 from cdoern/infra
fix pod network handling with a host network
This commit is contained in:
@ -42,6 +42,9 @@ func GetDefaultNamespaceMode(nsType string, cfg *config.Config, pod *libpod.Pod)
|
|||||||
podMode = true
|
podMode = true
|
||||||
case nsType == "net" && pod.SharesNet():
|
case nsType == "net" && pod.SharesNet():
|
||||||
podMode = true
|
podMode = true
|
||||||
|
case nsType == "net" && pod.NetworkMode() == "host":
|
||||||
|
toReturn.NSMode = specgen.Host
|
||||||
|
return toReturn, nil
|
||||||
case nsType == "cgroup" && pod.SharesCgroup():
|
case nsType == "cgroup" && pod.SharesCgroup():
|
||||||
podMode = true
|
podMode = true
|
||||||
}
|
}
|
||||||
|
@ -125,6 +125,19 @@ var _ = Describe("Podman pod create", func() {
|
|||||||
session = podmanTest.Podman([]string{"run", fedoraMinimal, "curl", "-f", "localhost"})
|
session = podmanTest.Podman([]string{"run", fedoraMinimal, "curl", "-f", "localhost"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).To(ExitWithError())
|
Expect(session).To(ExitWithError())
|
||||||
|
|
||||||
|
session = podmanTest.Podman([]string{"pod", "create", "--network", "host"})
|
||||||
|
session.WaitWithDefaultTimeout()
|
||||||
|
Expect(session).Should(Exit(0))
|
||||||
|
|
||||||
|
session = podmanTest.Podman([]string{"run", "-dt", "--pod", session.OutputToString(), ALPINE})
|
||||||
|
session.WaitWithDefaultTimeout()
|
||||||
|
Expect(session).Should(Exit(0))
|
||||||
|
|
||||||
|
session = podmanTest.Podman([]string{"inspect", "--format", "'{{.NetworkSettings.SandboxKey}}'", session.OutputToString()})
|
||||||
|
session.WaitWithDefaultTimeout()
|
||||||
|
Expect(session).Should(Exit(0))
|
||||||
|
Expect(session.OutputToString()).Should(ContainSubstring("''")) // no network path... host
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman pod correctly sets up IPCNS", func() {
|
It("podman pod correctly sets up IPCNS", func() {
|
||||||
|
Reference in New Issue
Block a user