Merge pull request #11011 from baude/initcontainers

implement init containers in podman
This commit is contained in:
openshift-ci[bot]
2021-08-05 13:52:15 +00:00
committed by GitHub
16 changed files with 366 additions and 20 deletions

View File

@ -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.