summaryrefslogtreecommitdiff
path: root/libpod/options.go
diff options
context:
space:
mode:
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 17a36008d..553206a8a 100644
--- a/libpod/options.go
+++ b/libpod/options.go
@@ -1768,6 +1768,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.