summaryrefslogtreecommitdiff
path: root/libpod/container.go
diff options
context:
space:
mode:
authorUrvashi Mohnani <umohnani@redhat.com>2021-08-25 12:37:51 -0400
committerUrvashi Mohnani <umohnani@redhat.com>2021-09-10 09:37:46 -0400
commitf5e4ffb5e46be03a81b4425d3fe080543fca7035 (patch)
tree979f0e8aee5aebaa8b41cf0620d311381e6a9f20 /libpod/container.go
parent580ac4c6abc336d984f3a09940a4ef3006f0e6a7 (diff)
downloadpodman-f5e4ffb5e46be03a81b4425d3fe080543fca7035.tar.gz
podman-f5e4ffb5e46be03a81b4425d3fe080543fca7035.tar.bz2
podman-f5e4ffb5e46be03a81b4425d3fe080543fca7035.zip
Add init containers to generate and play kube
Kubernetes has a concept of init containers that run and exit before the regular containers in a pod are started. We added init containers to podman pods as well. This patch adds support for generating init containers in the kube yaml when a pod we are converting had init containers. When playing a kube yaml, it detects an init container and creates such a container in podman accordingly. Note, only init containers created with the init type set to "always" will be generated as the "once" option deletes the init container after it has run and exited. Play kube will always creates init containers with the "always" init container type. Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
Diffstat (limited to 'libpod/container.go')
-rw-r--r--libpod/container.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/libpod/container.go b/libpod/container.go
index 0986a0d80..a4bbb5dd0 100644
--- a/libpod/container.go
+++ b/libpod/container.go
@@ -1062,6 +1062,11 @@ func (c *Container) IsInfra() bool {
return c.config.IsInfra
}
+// IsInitCtr returns whether the container is an init container
+func (c *Container) IsInitCtr() bool {
+ return len(c.config.InitContainerType) > 0
+}
+
// IsReadOnly returns whether the container is running in read only mode
func (c *Container) IsReadOnly() bool {
return c.config.Spec.Root.Readonly