summaryrefslogtreecommitdiff
path: root/libpod/options.go
diff options
context:
space:
mode:
authoropenshift-ci[bot] <75433959+openshift-ci[bot]@users.noreply.github.com>2021-08-05 13:52:15 +0000
committerGitHub <noreply@github.com>2021-08-05 13:52:15 +0000
commit1f0a24437d71f8fe2b2233a428202afcfe513666 (patch)
treee17f57dce6bf61d38a74fc6b8f011bffbb4082fa /libpod/options.go
parent117583c293713f2baa920c4035e820ad59fe6622 (diff)
parent3c3fa6fac4d0f8e89181ea2d4e1fe0318d24b6f4 (diff)
downloadpodman-1f0a24437d71f8fe2b2233a428202afcfe513666.tar.gz
podman-1f0a24437d71f8fe2b2233a428202afcfe513666.tar.bz2
podman-1f0a24437d71f8fe2b2233a428202afcfe513666.zip
Merge pull request #11011 from baude/initcontainers
implement init containers in podman
Diffstat (limited to 'libpod/options.go')
-rw-r--r--libpod/options.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/libpod/options.go b/libpod/options.go
index b021b9f50..071b085e7 100644
--- a/libpod/options.go
+++ b/libpod/options.go
@@ -1794,6 +1794,21 @@ func WithPidFile(pidFile string) CtrCreateOption {
}
}
+// WithInitCtrType indicates the container is a initcontainer
+func WithInitCtrType(containerType string) CtrCreateOption {
+ return func(ctr *Container) error {
+ if ctr.valid {
+ return define.ErrCtrFinalized
+ }
+ // Make sure the type is valid
+ if containerType == define.OneShotInitContainer || containerType == define.AlwaysInitContainer {
+ ctr.config.InitContainerType = containerType
+ return nil
+ }
+ return errors.Errorf("%s is invalid init container type", containerType)
+ }
+}
+
// Pod Creation Options
// WithInfraImage sets the infra image for libpod.