Merge pull request #12466 from dispensable/respect_pod_yaml_spec_hostname_when_play

Hostname in `spec.hostname` should be passed to infra ctr init opt
This commit is contained in:
OpenShift Merge Robot authored and GitHub committed 2021-12-03 19:20:45 +01:00
commit a93fa5e0c9
2 files changed
+6

No files matched your search

+1
View File
@@ -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)
+5
View File
@@ -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() {