mirror of
https://github.com/podman-container-tools/podman.git
synced 2026-10-11 00:17:41 +00:00
Merge pull request #29818 from BartSimpson001/feature/29811-init-container-inspect
inspect: expose init container information
This commit is contained in:
commit
7b76d74080
4 changed files with 28 additions and 0 deletions
|
|
@ -40,7 +40,9 @@ Valid placeholders for the Go template are listed below:
|
|||
| .Image | Container image ID (64-char hash) |
|
||||
| .ImageDigest | Container image digest (sha256:+64-char hash) |
|
||||
| .ImageName | Container image name (string) |
|
||||
| .InitContainerType | Type of init container if applicable (string) |
|
||||
| .IsInfra | Is this an infra container? (string: true/false) |
|
||||
| .IsInitCtr | Is this an init container? (string: true/false) |
|
||||
| .IsService | Is this a service container? (string: true/false) |
|
||||
| .KubeExitCodePropagation | Kube exit-code propagation (string) |
|
||||
| .LockNumber | Number of the container's Libpod lock |
|
||||
|
|
|
|||
|
|
@ -168,6 +168,8 @@ func (c *Container) getContainerInspectData(size bool, driverData *define.Driver
|
|||
Dependencies: c.Dependencies(),
|
||||
IsInfra: c.IsInfra(),
|
||||
IsService: c.IsService(),
|
||||
IsInitCtr: c.IsInitCtr(),
|
||||
InitContainerType: c.config.InitContainerType,
|
||||
KubeExitCodePropagation: config.KubeExitCodePropagation.String(),
|
||||
LockNumber: c.lock.ID(),
|
||||
UseImageHosts: c.config.UseImageHosts,
|
||||
|
|
|
|||
|
|
@ -807,6 +807,8 @@ type InspectContainerData struct {
|
|||
Namespace string `json:"Namespace"`
|
||||
IsInfra bool `json:"IsInfra"`
|
||||
IsService bool `json:"IsService"`
|
||||
IsInitCtr bool `json:"IsInitCtr"`
|
||||
InitContainerType string `json:"InitContainerType,omitempty"`
|
||||
KubeExitCodePropagation string `json:"KubeExitCodePropagation"`
|
||||
LockNumber uint32 `json:"lockNumber"`
|
||||
Config *InspectContainerConfig `json:"Config"`
|
||||
|
|
|
|||
|
|
@ -141,6 +141,28 @@ var _ = Describe("Podman container inspect", func() {
|
|||
Expect(data[0].Config.Env).To(ContainElement(Equal(secretName + "=*******")))
|
||||
})
|
||||
|
||||
It("podman inspect identifies init container", func() {
|
||||
podName := "test-init-pod"
|
||||
initCtrName := "test-init-ctr"
|
||||
normalCtrName := "test-normal-ctr"
|
||||
|
||||
podmanTest.PodmanExitCleanly("pod", "create", "--name", podName)
|
||||
|
||||
podmanTest.PodmanExitCleanly("create", "--pod", podName, "--init-ctr=always", "--name", initCtrName, ALPINE, "echo", "init")
|
||||
|
||||
podmanTest.PodmanExitCleanly("create", "--pod", podName, "--name", normalCtrName, ALPINE, "top")
|
||||
|
||||
initData := podmanTest.InspectContainer(initCtrName)
|
||||
Expect(initData).To(HaveLen(1))
|
||||
Expect(initData[0].IsInitCtr).To(BeTrue())
|
||||
Expect(initData[0].InitContainerType).To(Equal("always"))
|
||||
|
||||
normalData := podmanTest.InspectContainer(normalCtrName)
|
||||
Expect(normalData).To(HaveLen(1))
|
||||
Expect(normalData[0].IsInitCtr).To(BeFalse())
|
||||
Expect(normalData[0].InitContainerType).To(BeEmpty())
|
||||
})
|
||||
|
||||
It("podman inspect NetworkSettings DNSNames and Aliases", func() {
|
||||
netName := "dnstest"
|
||||
session := podmanTest.Podman([]string{"network", "create", netName})
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue