mirror of
https://github.com/containers/podman.git
synced 2025-06-25 11:57:13 +08:00
Hostname in spec.hostname
should be passed to infra ctr init opt
Fixes https://github.com/containers/podman/issues/12393 Signed-off-by: Qiang Wang <sunsetmask@gmail.com>
This commit is contained in:
@ -287,6 +287,7 @@ func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podY
|
|||||||
if podOpt.Infra {
|
if podOpt.Infra {
|
||||||
infraImage := util.DefaultContainerConfig().Engine.InfraImage
|
infraImage := util.DefaultContainerConfig().Engine.InfraImage
|
||||||
infraOptions := entities.NewInfraContainerCreateOptions()
|
infraOptions := entities.NewInfraContainerCreateOptions()
|
||||||
|
infraOptions.Hostname = podSpec.PodSpecGen.PodBasicConfig.Hostname
|
||||||
podSpec.PodSpecGen.InfraImage = infraImage
|
podSpec.PodSpecGen.InfraImage = infraImage
|
||||||
podSpec.PodSpecGen.NoInfra = false
|
podSpec.PodSpecGen.NoInfra = false
|
||||||
podSpec.PodSpecGen.InfraContainerSpec = specgen.NewSpecGenerator(infraImage, false)
|
podSpec.PodSpecGen.InfraContainerSpec = specgen.NewSpecGenerator(infraImage, false)
|
||||||
|
@ -1762,6 +1762,11 @@ var _ = Describe("Podman play kube", func() {
|
|||||||
inspect.WaitWithDefaultTimeout()
|
inspect.WaitWithDefaultTimeout()
|
||||||
Expect(inspect).Should(Exit(0))
|
Expect(inspect).Should(Exit(0))
|
||||||
Expect(inspect.OutputToString()).To(Equal(hostname))
|
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() {
|
It("podman play kube test HostAliases", func() {
|
||||||
|
Reference in New Issue
Block a user