7
// Valid restart policy types.
9
// RestartPolicyNone indicates that no restart policy has been requested
11
RestartPolicyNone = ""
12
// RestartPolicyNo is identical in function to RestartPolicyNone.
13
RestartPolicyNo = "no"
14
// RestartPolicyAlways unconditionally restarts the container.
15
RestartPolicyAlways = "always"
16
// RestartPolicyOnFailure restarts the container on non-0 exit code,
17
// with an optional maximum number of retries.
18
RestartPolicyOnFailure = "on-failure"
19
// RestartPolicyUnlessStopped unconditionally restarts unless stopped
20
// by the user. It is identical to Always except with respect to
21
// handling of system restart, which Podman does not yet support.
22
RestartPolicyUnlessStopped = "unless-stopped"
25
// RestartPolicyMap maps between restart-policy valid values to restart policy types
26
var RestartPolicyMap = map[string]string{
27
"none": RestartPolicyNone,
28
RestartPolicyNo: RestartPolicyNo,
29
RestartPolicyAlways: RestartPolicyAlways,
30
RestartPolicyOnFailure: RestartPolicyOnFailure,
31
RestartPolicyUnlessStopped: RestartPolicyUnlessStopped,
34
// Validate that the given string is a valid restart policy.
35
func ValidateRestartPolicy(policy string) error {
37
case RestartPolicyNone, RestartPolicyNo, RestartPolicyOnFailure, RestartPolicyAlways, RestartPolicyUnlessStopped:
40
return fmt.Errorf("%q is not a valid restart policy: %w", policy, ErrInvalidArg)
46
// AlwaysInitContainer is an init container that runs on each
47
// pod start (including restart)
48
AlwaysInitContainer = "always"
49
// OneShotInitContainer is a container that only runs as init once
50
// and is then deleted.
51
OneShotInitContainer = "once"
52
// ContainerInitPath is the default path of the mounted container init.
53
ContainerInitPath = "/run/podman-init"
58
// A Pod kube yaml spec
60
// A Deployment kube yaml spec
61
K8sKindDeployment = "deployment"
62
// A DaemonSet kube yaml spec
63
K8sKindDaemonSet = "daemonset"