mirror of
https://github.com/containers/podman.git
synced 2025-10-30 17:38:27 +08:00
vendor c/common@main
Required for using the newly added pod exit policies. Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
This commit is contained in:
3
vendor/github.com/containers/common/pkg/config/config.go
generated
vendored
3
vendor/github.com/containers/common/pkg/config/config.go
generated
vendored
@ -349,6 +349,9 @@ type EngineConfig struct {
|
||||
// OCIRuntimes are the set of configured OCI runtimes (default is runc).
|
||||
OCIRuntimes map[string][]string `toml:"runtimes,omitempty"`
|
||||
|
||||
// PodExitPolicy determines the behaviour when the last container of a pod exits.
|
||||
PodExitPolicy PodExitPolicy `toml:"pod_exit_policy,omitempty"`
|
||||
|
||||
// PullPolicy determines whether to pull image before creating or running a container
|
||||
// default is "missing"
|
||||
PullPolicy string `toml:"pull_policy,omitempty"`
|
||||
|
||||
3
vendor/github.com/containers/common/pkg/config/containers.conf
generated
vendored
3
vendor/github.com/containers/common/pkg/config/containers.conf
generated
vendored
@ -506,6 +506,9 @@ default_sysctls = [
|
||||
#
|
||||
#num_locks = 2048
|
||||
|
||||
# Set the exit policy of the pod when the last container exits.
|
||||
#pod_exit_policy = "continue"
|
||||
|
||||
# Whether to pull new image before running a container
|
||||
#
|
||||
#pull_policy = "missing"
|
||||
|
||||
2
vendor/github.com/containers/common/pkg/config/default.go
generated
vendored
2
vendor/github.com/containers/common/pkg/config/default.go
generated
vendored
@ -388,6 +388,8 @@ func defaultConfigFromMemory() (*EngineConfig, error) {
|
||||
c.MachineEnabled = false
|
||||
c.ChownCopiedFiles = true
|
||||
|
||||
c.PodExitPolicy = defaultPodExitPolicy
|
||||
|
||||
return c, nil
|
||||
}
|
||||
|
||||
|
||||
36
vendor/github.com/containers/common/pkg/config/pod_exit_policy.go
generated
vendored
Normal file
36
vendor/github.com/containers/common/pkg/config/pod_exit_policy.go
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
package config
|
||||
|
||||
import "fmt"
|
||||
|
||||
// PodExitPolicies includes the supported pod exit policies.
|
||||
var PodExitPolicies = []string{string(PodExitPolicyContinue), string(PodExitPolicyStop)}
|
||||
|
||||
// PodExitPolicy determines a pod's exit and stop behaviour.
|
||||
type PodExitPolicy string
|
||||
|
||||
const (
|
||||
// PodExitPolicyContinue instructs the pod to continue running when the
|
||||
// last container has exited.
|
||||
PodExitPolicyContinue PodExitPolicy = "continue"
|
||||
// PodExitPolicyStop instructs the pod to stop when the last container
|
||||
// has exited.
|
||||
PodExitPolicyStop = "stop"
|
||||
// PodExitPolicyUnsupported implies an internal error.
|
||||
// Negative for backwards compat.
|
||||
PodExitPolicyUnsupported = "invalid"
|
||||
|
||||
defaultPodExitPolicy = PodExitPolicyContinue
|
||||
)
|
||||
|
||||
// ParsePodExitPolicy parses the specified policy and returns an error if it is
|
||||
// invalid.
|
||||
func ParsePodExitPolicy(policy string) (PodExitPolicy, error) {
|
||||
switch policy {
|
||||
case "", string(PodExitPolicyContinue):
|
||||
return PodExitPolicyContinue, nil
|
||||
case string(PodExitPolicyStop):
|
||||
return PodExitPolicyStop, nil
|
||||
default:
|
||||
return PodExitPolicyUnsupported, fmt.Errorf("invalid pod exit policy: %q", policy)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user