Skip to content

Commit

Permalink
Merge pull request containers#12466 from dispensable/respect_pod_yaml…
Browse files Browse the repository at this point in the history
…_spec_hostname_when_play

Hostname in `spec.hostname` should be passed to infra ctr init opt
  • Loading branch information
openshift-merge-robot authored Dec 3, 2021
2 parents a50502d + 4e63f91 commit a93fa5e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/domain/infra/abi/play.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions test/e2e/play_kube_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit a93fa5e

Please sign in to comment.