Documentation ¶
Index ¶
- Constants
- func PrepareProcessExec(c *Container, cmd []string, tty bool) (*os.File, error)
- type Container
- func (c *Container) AddVolume(v ContainerVolume)
- func (c *Container) Annotations() map[string]string
- func (c *Container) BundlePath() string
- func (c *Container) Created() bool
- func (c *Container) CreatedAt() time.Time
- func (c *Container) CrioAnnotations() map[string]string
- func (c *Container) Dir() string
- func (c *Container) FromDisk() error
- func (c *Container) GetStopSignal() string
- func (c *Container) ID() string
- func (c *Container) IDMappings() *idtools.IDMappings
- func (c *Container) Image() string
- func (c *Container) ImageName() string
- func (c *Container) ImageRef() string
- func (c *Container) IntermediateMountPoint() string
- func (c *Container) Labels() map[string]string
- func (c *Container) LogPath() string
- func (c *Container) Metadata() *pb.ContainerMetadata
- func (c *Container) MountPoint() string
- func (c *Container) Name() string
- func (c *Container) NetNsPath() (string, error)
- func (c *Container) Sandbox() string
- func (c *Container) SeccompProfilePath() string
- func (c *Container) SetCreated()
- func (c *Container) SetIDMappings(mappings *idtools.IDMappings)
- func (c *Container) SetIntermediateMountPoint(imp string)
- func (c *Container) SetMountPoint(mp string)
- func (c *Container) SetSeccompProfilePath(pp string)
- func (c *Container) SetSpec(s *specs.Spec)
- func (c *Container) SetState(state *ContainerState)
- func (c *Container) Spec() specs.Spec
- func (c *Container) State() *ContainerState
- func (c *Container) StatePath() string
- func (c *Container) Volumes() []ContainerVolume
- type ContainerState
- type ContainerStorer
- type ContainerVolume
- type ExecSyncError
- type ExecSyncResponse
- type History
- type Runtime
- func (r *Runtime) ContainerStatus(c *Container) *ContainerState
- func (r *Runtime) CreateContainer(c *Container, cgroupParent string) (err error)
- func (r *Runtime) CurrentContainerStatus(c *Container) *ContainerState
- func (r *Runtime) DeleteContainer(c *Container) error
- func (r *Runtime) ExecSync(c *Container, command []string, timeout int64) (resp *ExecSyncResponse, err error)
- func (r *Runtime) Name() string
- func (r *Runtime) Path(c *Container) string
- func (r *Runtime) PauseContainer(c *Container) error
- func (r *Runtime) SetStartFailed(c *Container, err error)
- func (r *Runtime) StartContainer(c *Container) error
- func (r *Runtime) StopContainer(ctx context.Context, c *Container, timeout int64) error
- func (r *Runtime) UnpauseContainer(c *Container) error
- func (r *Runtime) UpdateContainer(c *Container, res *rspec.LinuxResources) error
- func (r *Runtime) UpdateStatus(c *Container) error
- func (r *Runtime) Version() (string, error)
- func (r *Runtime) WaitContainerStateStopped(ctx context.Context, c *Container, timeout int64) (err error)
- type StoreFilter
- type StoreReducer
Constants ¶
const ( // ContainerStateCreated represents the created state of a container ContainerStateCreated = "created" // ContainerStatePaused represents the paused state of a container ContainerStatePaused = "paused" // ContainerStateRunning represents the running state of a container ContainerStateRunning = "running" // ContainerStateStopped represents the stopped state of a container ContainerStateStopped = "stopped" // ContainerCreateTimeout represents the value of container creating timeout ContainerCreateTimeout = 240 * time.Second // CgroupfsCgroupsManager represents cgroupfs native cgroup manager CgroupfsCgroupsManager = "cgroupfs" // SystemdCgroupsManager represents systemd native cgroup manager SystemdCgroupsManager = "systemd" // ContainerExitsDir is the location of container exit dirs ContainerExitsDir = "/var/run/crio/exits" // ContainerAttachSocketDir is the location for container attach sockets ContainerAttachSocketDir = "/var/run/crio" // BufSize is the size of buffers passed in to socekts BufSize = 8192 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
Container represents a runtime container.
func NewContainer ¶
func NewContainer(id string, name string, bundlePath string, logPath string, netns string, labels map[string]string, crioAnnotations map[string]string, annotations map[string]string, image string, imageName string, imageRef string, metadata *pb.ContainerMetadata, sandbox string, terminal bool, stdin bool, stdinOnce bool, privileged bool, trusted bool, dir string, created time.Time, stopSignal string) (*Container, error)
NewContainer creates a container object.
func (*Container) AddVolume ¶ added in v1.0.0
func (c *Container) AddVolume(v ContainerVolume)
AddVolume adds a volume to list of container volumes.
func (*Container) Annotations ¶
Annotations returns the annotations of the container.
func (*Container) BundlePath ¶
BundlePath returns the bundlePath of the container.
func (*Container) Created ¶ added in v1.11.5
Created returns whether the container was created successfully
func (*Container) CrioAnnotations ¶ added in v1.0.0
CrioAnnotations returns the crio annotations of the container.
func (*Container) GetStopSignal ¶ added in v1.0.0
GetStopSignal returns the container's own stop signal configured from the image configuration or the default one.
func (*Container) IDMappings ¶ added in v1.11.0
func (c *Container) IDMappings() *idtools.IDMappings
IDMappings returns the ID/GID mappings used for the container
func (*Container) IntermediateMountPoint ¶ added in v1.11.0
IntermediateMountPoint returns the container mount point
func (*Container) Metadata ¶
func (c *Container) Metadata() *pb.ContainerMetadata
Metadata returns the metadata of the container.
func (*Container) MountPoint ¶ added in v1.0.0
MountPoint returns the container mount point
func (*Container) SeccompProfilePath ¶ added in v1.8.0
SeccompProfilePath returns the seccomp profile path
func (*Container) SetCreated ¶ added in v1.11.5
func (c *Container) SetCreated()
SetCreated sets the created flag to true once container is created
func (*Container) SetIDMappings ¶ added in v1.11.0
func (c *Container) SetIDMappings(mappings *idtools.IDMappings)
SetIDMappings sets the ID/GID mappings used for the container
func (*Container) SetIntermediateMountPoint ¶ added in v1.11.0
SetIntermediateMountPoint sets the container intermediate mount point
func (*Container) SetMountPoint ¶ added in v1.0.0
SetMountPoint sets the container mount point
func (*Container) SetSeccompProfilePath ¶ added in v1.8.0
SetSeccompProfilePath sets the seccomp profile path
func (*Container) SetState ¶ added in v1.0.0
func (c *Container) SetState(state *ContainerState)
SetState sets the conainer state
XXX: DO NOT EVER USE THIS, THIS IS JUST USEFUL FOR MOCKING!!!
func (*Container) State ¶ added in v1.0.0
func (c *Container) State() *ContainerState
State returns the state of the running container
func (*Container) Volumes ¶ added in v1.0.0
func (c *Container) Volumes() []ContainerVolume
Volumes returns the list of container volumes.
type ContainerState ¶
type ContainerState struct { specs.State Created time.Time `json:"created"` Started time.Time `json:"started,omitempty"` Finished time.Time `json:"finished,omitempty"` ExitCode int32 `json:"exitCode,omitempty"` OOMKilled bool `json:"oomKilled,omitempty"` Error string `json:"error,omitempty"` }
ContainerState represents the status of a container.
type ContainerStorer ¶ added in v1.0.0
type ContainerStorer interface { // Add appends a new container to the store. Add(string, *Container) // Get returns a container from the store by the identifier it was stored with. Get(string) *Container // Delete removes a container from the store by the identifier it was stored with. Delete(string) // List returns a list of containers from the store. List() []*Container // Size returns the number of containers in the store. Size() int // First returns the first container found in the store by a given filter. First(StoreFilter) *Container // ApplyAll calls the reducer function with every container in the store. ApplyAll(StoreReducer) }
ContainerStorer defines an interface that any container store must implement.
func NewMemoryStore ¶
func NewMemoryStore() ContainerStorer
NewMemoryStore initializes a new memory store.
type ContainerVolume ¶ added in v1.0.0
type ContainerVolume struct { ContainerPath string `json:"container_path"` HostPath string `json:"host_path"` Readonly bool `json:"readonly"` }
ContainerVolume is a bind mount for the container.
type ExecSyncError ¶
ExecSyncError wraps command's streams, exit code and error on ExecSync error.
func (ExecSyncError) Error ¶
func (e ExecSyncError) Error() string
type ExecSyncResponse ¶
ExecSyncResponse is returned from ExecSync.
type History ¶
type History []*Container
History is a convenience type for storing a list of containers, sorted by creation date in descendant order.
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
Runtime stores the information about a oci runtime
func New ¶
func New(runtimeTrustedPath string, runtimeUntrustedPath string, trustLevel string, conmonPath string, conmonEnv []string, cgroupManager string, containerExitsDir string, logSizeMax int64, noPivot bool) (*Runtime, error)
New creates a new Runtime with options provided
func (*Runtime) ContainerStatus ¶
func (r *Runtime) ContainerStatus(c *Container) *ContainerState
ContainerStatus returns the state of a container.
func (*Runtime) CreateContainer ¶
CreateContainer creates a container.
func (*Runtime) CurrentContainerStatus ¶ added in v1.11.8
func (r *Runtime) CurrentContainerStatus(c *Container) *ContainerState
CurrentContainerStatus returns the state of a container without using a lock.
func (*Runtime) DeleteContainer ¶
DeleteContainer deletes a container.
func (*Runtime) ExecSync ¶
func (r *Runtime) ExecSync(c *Container, command []string, timeout int64) (resp *ExecSyncResponse, err error)
ExecSync execs a command in a container and returns it's stdout, stderr and return code.
func (*Runtime) Path ¶
Path returns the full path the OCI Runtime executable. Depending if the container is privileged and/or trusted, this will return either the trusted or untrusted runtime path.
func (*Runtime) PauseContainer ¶ added in v1.0.0
PauseContainer pauses a container.
func (*Runtime) SetStartFailed ¶ added in v1.0.0
SetStartFailed sets the container state appropriately after a start failure
func (*Runtime) StartContainer ¶
StartContainer starts a container.
func (*Runtime) StopContainer ¶
StopContainer stops a container. Timeout is given in seconds.
func (*Runtime) UnpauseContainer ¶ added in v1.0.0
UnpauseContainer unpauses a container.
func (*Runtime) UpdateContainer ¶ added in v1.8.0
func (r *Runtime) UpdateContainer(c *Container, res *rspec.LinuxResources) error
UpdateContainer updates container resources
func (*Runtime) UpdateStatus ¶
UpdateStatus refreshes the status of the container.
func (*Runtime) WaitContainerStateStopped ¶ added in v1.10.0
func (r *Runtime) WaitContainerStateStopped(ctx context.Context, c *Container, timeout int64) (err error)
WaitContainerStateStopped runs a loop polling UpdateStatus(), seeking for the container status to be updated to 'stopped'. Either it gets the expected status and returns nil, or it reaches the timeout and returns an error.
type StoreFilter ¶
StoreFilter defines a function to filter container in the store.
type StoreReducer ¶
type StoreReducer func(*Container)
StoreReducer defines a function to manipulate containers in the store