summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pkg/domain/infra/abi/play.go1
-rw-r--r--test/e2e/play_kube_test.go5
2 files changed, 6 insertions, 0 deletions
diff --git a/pkg/domain/infra/abi/play.go b/pkg/domain/infra/abi/play.go
index ab52fad64..4c024a3d8 100644
--- a/pkg/domain/infra/abi/play.go
+++ b/pkg/domain/infra/abi/play.go
@@ -316,6 +316,7 @@ func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podY
if podOpt.Infra {
infraImage := util.DefaultContainerConfig().Engine.InfraImage
infraOptions := entities.NewInfraContainerCreateOptions()
+ infraOptions.Hostname = podSpec.PodSpecGen.PodBasicConfig.Hostname
podSpec.PodSpecGen.InfraImage = infraImage
podSpec.PodSpecGen.NoInfra = false
podSpec.PodSpecGen.InfraContainerSpec = specgen.NewSpecGenerator(infraImage, false)
diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go
index 96ad2954c..36010704f 100644
--- a/test/e2e/play_kube_test.go
+++ b/test/e2e/play_kube_test.go
@@ -1795,6 +1795,11 @@ var _ = Describe("Podman play kube", func() {
inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(Equal(hostname))
+
+ hostnameInCtr := podmanTest.Podman([]string{"exec", getCtrNameInPod(pod), "hostname"})
+ hostnameInCtr.WaitWithDefaultTimeout()
+ Expect(hostnameInCtr).Should(Exit(0))
+ Expect(hostnameInCtr.OutputToString()).To(Equal(hostname))
})
It("podman play kube test HostAliases", func() {