forked from kata-containers/kata-containers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.go
39 lines (33 loc) · 1.33 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright (c) 2017 Intel Corporation
//
// SPDX-License-Identifier: Apache-2.0
//
package virtcontainers
// ContainerType defines a type of container.
type ContainerType string
// List different types of containers
const (
// PodContainer identifies a container that should be associated with an existing pod
PodContainer ContainerType = "pod_container"
// PodSandbox identifies an infra container that will be used to create the pod
PodSandbox ContainerType = "pod_sandbox"
// SingleContainer is utilized to describe a container that didn't have a container/sandbox
// annotation applied. This is expected when dealing with non-pod container (ie, running
// from ctr, podman, etc).
SingleContainer ContainerType = "single_container"
// UnknownContainerType specifies a container that provides container type annotation, but
// it is unknown.
UnknownContainerType ContainerType = "unknown_container_type"
)
// IsSandbox determines if the container type can be considered as a sandbox.
// We can consider a sandbox in case we have a PodSandbox or a "regular" container
func (cType ContainerType) IsSandbox() bool {
return cType == PodSandbox || cType == SingleContainer
}
func (t ContainerType) IsCriSandbox() bool {
return t == PodSandbox
}
// "Regular" Container
func (t ContainerType) IsSingleContainer() bool {
return t == SingleContainer
}