From f250560a8043f25771f8ba41b2faf585829b0c9b Mon Sep 17 00:00:00 2001 From: Andrei Natanael Cosma Date: Sun, 2 Oct 2022 19:08:17 +0200 Subject: Add pods created by kube play to a default network In order to allow pods to reach other pods (as in Kubernetes) they all need to be added to the same network. A network is created (if it doesn't exist) and pods created by play-kube are added to that network. When network options are passed to kube command the pods are not attached to the default kube network. Signed-off-by: Andrei Natanael Cosma --- docs/source/markdown/podman-kube-play.1.md.in | 2 +- pkg/domain/infra/abi/play.go | 21 +++++++++++++++++++++ test/e2e/play_kube_test.go | 15 +++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/docs/source/markdown/podman-kube-play.1.md.in b/docs/source/markdown/podman-kube-play.1.md.in index d3a6eaa03..dea47c307 100644 --- a/docs/source/markdown/podman-kube-play.1.md.in +++ b/docs/source/markdown/podman-kube-play.1.md.in @@ -155,7 +155,7 @@ Note: When joining multiple networks you should use the **--network name:mac=\ 0 { ns, networks, netOpts, err := specgen.ParseNetworkFlag(options.Networks) if err != nil { diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go index 651cb1074..8b9e43f65 100644 --- a/test/e2e/play_kube_test.go +++ b/test/e2e/play_kube_test.go @@ -3000,6 +3000,21 @@ MemoryReservation: {{ .HostConfig.MemoryReservation }}`}) Expect(logs.OutputToString()).To(Equal(netns)) }) + It("podman play kube test with kube default network", func() { + pod := getPod() + err := generateKubeYaml("pod", pod, kubeYaml) + Expect(err).To(BeNil()) + + kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube.WaitWithDefaultTimeout() + Expect(kube).Should(Exit(0)) + + inspect := podmanTest.Podman([]string{"inspect", pod.Name, "--format", "{{ .InfraConfig.Networks }}"}) + inspect.WaitWithDefaultTimeout() + Expect(inspect).Should(Exit(0)) + Expect(inspect.OutputToString()).To(Equal("[podman-default-kube-network]")) + }) + It("podman play kube persistentVolumeClaim", func() { volName := "myvol" volDevice := "tmpfs" -- cgit v1.2.3-54-g00ecf