spiegel_podman/libpod/define/container.go
Brent Baude 3c3fa6fac4 implement init containers in podman
this is the first pass at implementing init containers for podman pods.
init containersare made popular by k8s as a way to run setup for pods
before the pods standard containers run.

unlike k8s, we support two styles of init containers: always and
oneshot.  always means the container stays in the pod and starts
whenever a pod is started.  this does not apply to pods restarting.
oneshot means the container runs onetime when the pod starts and then is
removed.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2021-08-04 14:14:36 -05:00

38 lines
1.4 KiB
Go

package define
// Valid restart policy types.
const (
// RestartPolicyNone indicates that no restart policy has been requested
// by a container.
RestartPolicyNone = ""
// RestartPolicyNo is identical in function to RestartPolicyNone.
RestartPolicyNo = "no"
// RestartPolicyAlways unconditionally restarts the container.
RestartPolicyAlways = "always"
// RestartPolicyOnFailure restarts the container on non-0 exit code,
// with an optional maximum number of retries.
RestartPolicyOnFailure = "on-failure"
// RestartPolicyUnlessStopped unconditionally restarts unless stopped
// by the user. It is identical to Always except with respect to
// handling of system restart, which Podman does not yet support.
RestartPolicyUnlessStopped = "unless-stopped"
)
// RestartPolicyMap maps between restart-policy valid values to restart policy types
var RestartPolicyMap = map[string]string{
"none": RestartPolicyNone,
RestartPolicyNo: RestartPolicyNo,
RestartPolicyAlways: RestartPolicyAlways,
RestartPolicyOnFailure: RestartPolicyOnFailure,
RestartPolicyUnlessStopped: RestartPolicyUnlessStopped,
}
// InitContainerTypes
const (
// AlwaysInitContainer is an init container than runs on each
// pod start (including restart)
AlwaysInitContainer = "always"
// OneShotInitContainer is a container that only runs as init once
// and is then deleted.
OneShotInitContainer = "oneshot"
)