podman

Форк
0
/
container.go 
64 строки · 2.1 Кб
1
package define
2

3
import (
4
	"fmt"
5
)
6

7
// Valid restart policy types.
8
const (
9
	// RestartPolicyNone indicates that no restart policy has been requested
10
	// by a container.
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"
23
)
24

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,
32
}
33

34
// Validate that the given string is a valid restart policy.
35
func ValidateRestartPolicy(policy string) error {
36
	switch policy {
37
	case RestartPolicyNone, RestartPolicyNo, RestartPolicyOnFailure, RestartPolicyAlways, RestartPolicyUnlessStopped:
38
		return nil
39
	default:
40
		return fmt.Errorf("%q is not a valid restart policy: %w", policy, ErrInvalidArg)
41
	}
42
}
43

44
// InitContainerTypes
45
const (
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"
54
)
55

56
// Kubernetes Kinds
57
const (
58
	// A Pod kube yaml spec
59
	K8sKindPod = "pod"
60
	// A Deployment kube yaml spec
61
	K8sKindDeployment = "deployment"
62
	// A DaemonSet kube yaml spec
63
	K8sKindDaemonSet = "daemonset"
64
)
65

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.