mirror of
https://github.com/podman-container-tools/podman.git
synced 2026-08-05 00:15:44 +00:00
fix: ensure infra image is set from infra container spec in PodConfigToSpec
fixes #21609 Signed-off-by: Nabil Houidi <35373676+NabilHouidi@users.noreply.github.com>
This commit is contained in:
parent
d66f0856a8
commit
d44655537e
2 changed files with 14 additions and 3 deletions
|
|
@ -356,14 +356,15 @@ func PodConfigToSpec(rt *libpod.Runtime, spec *specgen.PodSpecGenerator, infraOp
|
|||
return nil, err
|
||||
}
|
||||
|
||||
if len(spec.InfraContainerSpec.Image) > 0 {
|
||||
spec.InfraImage = spec.InfraContainerSpec.Image
|
||||
}
|
||||
|
||||
spec.Name = name
|
||||
}
|
||||
|
||||
// need to reset hostname, name etc of both pod and infra
|
||||
spec.Hostname = ""
|
||||
|
||||
if len(spec.InfraContainerSpec.Image) > 0 {
|
||||
spec.InfraImage = spec.InfraContainerSpec.Image
|
||||
}
|
||||
return pod, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,4 +57,14 @@ var _ = Describe("Podman generate spec", func() {
|
|||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
})
|
||||
|
||||
It("generate spec for pod with no infra container", func() {
|
||||
session := podmanTest.Podman([]string{"pod", "create", "--share", "none", "--name", "podspecgen2"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"generate", "spec", "--compact", "podspecgen2"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue