summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMilivoje Legenovic <m.legenovic@gmail.com>2021-01-27 23:20:28 +0100
committerMilivoje Legenovic <m.legenovic@gmail.com>2021-01-30 09:08:36 +0100
commitcdbbc6120bad7c9310c4f3500fafa4b6c4d15c57 (patch)
tree45a5ec473a81ab3413fdf56fefd0e4f044ea8c8f /test
parent2686e406a650f8ceac4b3763e0cfba16090d1c1b (diff)
downloadpodman-cdbbc6120bad7c9310c4f3500fafa4b6c4d15c57.tar.gz
podman-cdbbc6120bad7c9310c4f3500fafa4b6c4d15c57.tar.bz2
podman-cdbbc6120bad7c9310c4f3500fafa4b6c4d15c57.zip
podman generate kube ignores --network=host
Signed-off-by: Milivoje Legenovic <m.legenovic@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/e2e/generate_kube_test.go36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/e2e/generate_kube_test.go b/test/e2e/generate_kube_test.go
index 8800f9057..83b9cfb14 100644
--- a/test/e2e/generate_kube_test.go
+++ b/test/e2e/generate_kube_test.go
@@ -60,6 +60,7 @@ var _ = Describe("Podman generate kube", func() {
pod := new(v1.Pod)
err := yaml.Unmarshal(kube.Out.Contents(), pod)
Expect(err).To(BeNil())
+ Expect(pod.Spec.HostNetwork).To(Equal(false))
numContainers := 0
for range pod.Spec.Containers {
@@ -144,6 +145,7 @@ var _ = Describe("Podman generate kube", func() {
pod := new(v1.Pod)
err := yaml.Unmarshal(kube.Out.Contents(), pod)
Expect(err).To(BeNil())
+ Expect(pod.Spec.HostNetwork).To(Equal(false))
numContainers := 0
for range pod.Spec.Containers {
@@ -152,6 +154,40 @@ var _ = Describe("Podman generate kube", func() {
Expect(numContainers).To(Equal(1))
})
+ It("podman generate kube on pod with host network", func() {
+ podSession := podmanTest.Podman([]string{"pod", "create", "--name", "testHostNetwork", "--network", "host"})
+ podSession.WaitWithDefaultTimeout()
+ Expect(podSession.ExitCode()).To(Equal(0))
+
+ session := podmanTest.Podman([]string{"create", "--name", "topcontainer", "--pod", "testHostNetwork", "--network", "host", ALPINE, "top"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ kube := podmanTest.Podman([]string{"generate", "kube", "testHostNetwork"})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube.ExitCode()).To(Equal(0))
+
+ pod := new(v1.Pod)
+ err := yaml.Unmarshal(kube.Out.Contents(), pod)
+ Expect(err).To(BeNil())
+ Expect(pod.Spec.HostNetwork).To(Equal(true))
+ })
+
+ It("podman generate kube on container with host network", func() {
+ session := podmanTest.RunTopContainerWithArgs("topcontainer", []string{"--network", "host"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ kube := podmanTest.Podman([]string{"generate", "kube", "topcontainer"})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube.ExitCode()).To(Equal(0))
+
+ pod := new(v1.Pod)
+ err := yaml.Unmarshal(kube.Out.Contents(), pod)
+ Expect(err).To(BeNil())
+ Expect(pod.Spec.HostNetwork).To(Equal(true))
+ })
+
It("podman generate kube on pod with hostAliases", func() {
podName := "testHost"
testIP := "127.0.0.1"