Documentation
¶
Overview ¶
Package boot loads the kernel and runs a container.
Index ¶
- Constants
- Variables
- func GetAnnotationCheckpointCompression(spec *specs.Spec) (statefile.CompressionLevel, error)
- func GetAnnotationCheckpointDirect(spec *specs.Spec) bool
- func GetAnnotationCheckpointPath(conf *config.Config, spec *specs.Spec) (string, error)
- func GetAnnotationFSCheckpointDirect(spec *specs.Spec) bool
- func GetAnnotationFSCheckpointPath(spec *specs.Spec) string
- func ParseMountOptions(opts []string) *vfs.MountOptions
- func SelfFilestorePath(mountSrc, sandboxID string) string
- type Args
- type BindOpt
- type CPU
- type CPUUsage
- type ContainerRuntimeState
- type CreateArgs
- type CreateLinksAndRoutesArgs
- type CreateTraceSessionArgs
- type DefaultRoute
- type Event
- type EventOut
- type FDBasedLink
- type FDMapping
- type FSSaveArgs
- type HostTHP
- type IPWithPrefix
- type InitConfig
- type InitPluginStackArgs
- type Loader
- func (l *Loader) ConfigureNetwork(s inet.Stack) error
- func (l *Loader) Destroy()
- func (l *Loader) FSSave() error
- func (l *Loader) GetContainerSpecs() map[string]*specs.Spec
- func (l *Loader) Run() error
- func (l *Loader) SaveAsync() (err error)
- func (l *Loader) SpecEnviron(containerName string) []string
- func (l *Loader) WaitExit() linux.WaitStatus
- func (l *Loader) WaitForStartSignal()
- type LoopbackLink
- type Memory
- type MemoryEntry
- type MountArgs
- type MountHint
- type Neighbor
- type Network
- type NetworkInterface
- type Pids
- type PodMountHints
- type PortForwardOpts
- type RestoreOpts
- type RootfsHint
- type Route
- type Savings
- type ShareType
- type SignalArgs
- type SignalDeliveryMode
- type StartArgs
- type Stats
- type WaitFSRestoreArgs
- type WaitPIDArgs
- type XDPLink
Constants ¶
const ( // ContMgrCheckpoint checkpoints a container. ContMgrCheckpoint = "containerManager.Checkpoint" // ContMgrCreateSubcontainer creates a sub-container. ContMgrCreateSubcontainer = "containerManager.CreateSubcontainer" // ContMgrDestroySubcontainer is used to stop a sub-container and free all // associated resources in the sandbox. ContMgrDestroySubcontainer = "containerManager.DestroySubcontainer" // ContMgrEvent gets stats about the container used by "runsc events". ContMgrEvent = "containerManager.Event" // ContMgrExecuteAsync executes a command in a container. ContMgrExecuteAsync = "containerManager.ExecuteAsync" // ContMgrFSSave saves a filesystem checkpoint. ContMgrFSSave = "containerManager.FSSave" // ContMgrGetSavings gets the savings for restored sandboxes. ContMgrGetSavings = "containerManager.GetSavings" // ContMgrPortForward starts port forwarding with the sandbox. ContMgrPortForward = "containerManager.PortForward" // ContMgrProcesses lists processes running in a container. ContMgrProcesses = "containerManager.Processes" // ContMgrRestore restores a container from a statefile. ContMgrRestore = "containerManager.Restore" // ContMgrRestoreSubcontainer restores a container from a statefile. ContMgrRestoreSubcontainer = "containerManager.RestoreSubcontainer" // ContMgrPause pauses all tasks, blocking until they are stopped. ContMgrPause = "containerManager.Pause" // ContMgrResume resumes all tasks. ContMgrResume = "containerManager.Resume" // ContMgrSignal sends a signal to a container. ContMgrSignal = "containerManager.Signal" // ContMgrStartSubcontainer starts a sub-container inside a running sandbox. ContMgrStartSubcontainer = "containerManager.StartSubcontainer" // ContMgrWait waits on the init process of the container and returns its // ExitStatus. ContMgrWait = "containerManager.Wait" // ContMgrWaitPID waits on a process with a certain PID in the sandbox and // return its ExitStatus. ContMgrWaitPID = "containerManager.WaitPID" // ContMgrWaitCheckpoint waits for the next Kernel checkpoint to complete. ContMgrWaitCheckpoint = "containerManager.WaitCheckpoint" // ContMgrWaitRestore waits for the Kernel restore to complete. ContMgrWaitRestore = "containerManager.WaitRestore" // ContMgrWaitFSCheckpoint waits for the next filesystem checkpoint save to // complete. ContMgrWaitFSCheckpoint = "containerManager.WaitFSCheckpoint" // ContMgrWaitFSRestore waits for filesystem checkpoint restore to complete // for all current containers. ContMgrWaitFSRestore = "containerManager.WaitFSRestore" // ContMgrRootContainerStart starts a new sandbox with a root container. ContMgrRootContainerStart = "containerManager.StartRoot" // ContMgrCreateTraceSession starts a trace session. ContMgrCreateTraceSession = "containerManager.CreateTraceSession" // ContMgrDeleteTraceSession deletes a trace session. ContMgrDeleteTraceSession = "containerManager.DeleteTraceSession" // ContMgrListTraceSessions lists a trace session. ContMgrListTraceSessions = "containerManager.ListTraceSessions" // ContMgrProcfsDump dumps sandbox procfs state. ContMgrProcfsDump = "containerManager.ProcfsDump" // ContMgrMount mounts a filesystem in a container. ContMgrMount = "containerManager.Mount" // ContMgrContainerRuntimeState returns the runtime state of a container. ContMgrContainerRuntimeState = "containerManager.ContainerRuntimeState" // ContMgrSetNetworkArgs sets network args in loader without creating links. ContMgrSetNetworkArgs = "containerManager.SetNetworkArgs" // ContMgrGetNetworkConfig returns the network interfaces and routes applied // during the creation of root container. ContMgrGetNetworkConfig = "containerManager.GetNetworkConfig" )
const ( // NetworkInitPluginStack initializes third-party network stack. NetworkInitPluginStack = "Network.InitPluginStack" // DebugStacks collects sandbox stacks for debugging. DebugStacks = "debug.Stacks" )
const ( ProfileCPU = "Profile.CPU" ProfileHeap = "Profile.Heap" ProfileBlock = "Profile.Block" ProfileMutex = "Profile.Mutex" ProfileTrace = "Profile.Trace" )
Profiling related commands (see pprof.go for more details).
const ( UsageCollect = "Usage.Collect" UsageUsageFD = "Usage.UsageFD" )
Usage related commands (see usage.go for more details).
const ( MetricsGetRegistered = "Metrics.GetRegisteredMetrics" MetricsExport = "Metrics.Export" )
Metrics related commands (see metrics.go).
const ( CgroupsReadControlFiles = "Cgroups.ReadControlFiles" CgroupsWriteControlFiles = "Cgroups.WriteControlFiles" )
Commands for interacting with cgroupfs within the sandbox.
const ( FsTarRootfsUpperLayer = "Fs.TarRootfsUpperLayer" FsRead = "Fs.Read" )
FS-related commands (see fs.go for more details).
const ( // MountPrefix is the annotation prefix for mount hints applied at the pod level. MountPrefix = "dev.gvisor.spec.mount." // RootfsPrefix is the annotation prefix for rootfs hint applied at the container level. RootfsPrefix = "dev.gvisor.spec.rootfs." )
const ( // VersionKey is the key used to save runsc version in the save metadata and compare // it across checkpoint restore. VersionKey = "runsc_version" // ContainerCountKey is the key used to save number of containers in the save metadata. ContainerCountKey = "container_count" // ContainerSpecsKey is the key used to add and pop the container specs to the // metadata during save/restore. ContainerSpecsKey = "container_specs" )
const ( Bind = "bind" Nonefs = "none" )
Supported filesystems that map to different internal filesystems.
const (
LoggingChange = "Logging.Change"
)
Logging related commands (see logging.go for more details).
Variables ¶
var DefaultLoopbackLink = LoopbackLink{ Name: "lo", Addresses: []IPWithPrefix{ {Address: net.IP("\x7f\x00\x00\x01"), PrefixLen: 8}, {Address: net.IPv6loopback, PrefixLen: 128}, }, Routes: []Route{ { Destination: net.IPNet{ IP: net.IPv4(0x7f, 0, 0, 0), Mask: net.IPv4Mask(0xff, 0, 0, 0), }, }, { Destination: net.IPNet{ IP: net.IPv6loopback, Mask: net.IPMask(strings.Repeat("\xff", net.IPv6len)), }, }, }, }
DefaultLoopbackLink contains IP addresses and routes of "127.0.0.1/8" and "::1/8" on "lo" interface.
Functions ¶
func GetAnnotationCheckpointCompression ¶
func GetAnnotationCheckpointCompression(spec *specs.Spec) (statefile.CompressionLevel, error)
GetAnnotationCheckpointCompression returns the checkpoint compression level specified in the container annotation.
func GetAnnotationCheckpointDirect ¶
GetAnnotationCheckpointDirect returns true if the checkpoint is direct.
func GetAnnotationCheckpointPath ¶
GetAnnotationCheckpointPath returns the checkpoint path specified in the container annotation. Return empty string if no annotation is specified.
func GetAnnotationFSCheckpointDirect ¶
GetAnnotationFSCheckpointDirect returns true if filesystem checkpoint I/O controlled by the containing annotation should use O_DIRECT.
func GetAnnotationFSCheckpointPath ¶
GetAnnotationFSCheckpointPath returns the filesystem checkpoint path specified in the container annotation. Return empty string if no annotation is specified.
func ParseMountOptions ¶
func ParseMountOptions(opts []string) *vfs.MountOptions
ParseMountOptions converts specs.Mount.Options to vfs.MountOptions.
func SelfFilestorePath ¶
SelfFilestorePath returns the path at which the self filestore file is stored for a given mount.
Types ¶
type Args ¶
type Args struct {
// Id is the sandbox ID.
ID string
// Spec is the sandbox specification.
Spec *specs.Spec
// Conf is the system configuration.
Conf *config.Config
// ControllerFD is the FD to the URPC controller. The Loader takes ownership
// of this FD and may close it at any time.
ControllerFD int
// Device is an optional argument that is passed to the platform. The Loader
// takes ownership of this file and may close it at any time.
Device *fd.FD
// GoferFDs is an array of FDs used to connect with the Gofer. The Loader
// takes ownership of these FDs and may close them at any time.
GoferFDs []int
// DevGoferFD is the FD for the dev gofer connection. The Loader takes
// ownership of this FD and may close it at any time.
DevGoferFD int
// StdioFDs is the stdio for the application. The Loader takes ownership of
// these FDs and may close them at any time.
StdioFDs []int
// PassFDs are user-supplied FD mappings from host to guest descriptors.
// The Loader takes ownership of these FDs and may close them at any time.
PassFDs []FDMapping
// ExecFD is the host file descriptor used for program execution.
ExecFD int
// GoferFilestoreFDs are FDs to the regular files that will back the tmpfs or
// overlayfs mount for certain gofer mounts.
GoferFilestoreFDs []int
// GoferMountConfs contains information about how the gofer mounts have been
// configured. The first entry is for rootfs and the following entries are
// for bind mounts in Spec.Mounts (in the same order).
GoferMountConfs []specutils.GoferMountConf
// NumCPU is the number of CPUs to create inside the sandbox.
NumCPU int
// CPUQuota and CPUPeriod are the raw host CFS settings that should be
// reflected by sandbox cgroupfs.
CPUQuota int64
CPUPeriod int64
// TotalMem is the initial amount of total memory to report back to the
// container.
TotalMem uint64
// TotalHostMem is the total memory reported by host /proc/meminfo.
TotalHostMem uint64
// UserLogFD is the file descriptor to write user logs to.
UserLogFD int
// ProductName is the value to show in
// /sys/devices/virtual/dmi/id/product_name.
ProductName string
// PodInitConfigFD is the file descriptor to a file passed in the
// --pod-init-config flag
PodInitConfigFD int
// SinkFDs is an ordered array of file descriptors to be used by seccheck
// sinks configured from the --pod-init-config file.
SinkFDs []int
// ProfileOpts contains the set of profiles to enable and the
// corresponding FDs where profile data will be written.
ProfileOpts profile.Opts
// NvidiaDriverVersion is the NVIDIA driver ABI version to use for
// communicating with NVIDIA devices on the host.
NvidiaDriverVersion nvconf.DriverVersion
NvidiaHostSettings *nvconf.HostSettings
// HostTHP contains host transparent hugepage settings.
HostTHP HostTHP
// SaveFDs are FDs used for user-triggered checkpoint saving.
SaveFDs []*fd.FD
// If SaveCheckpointGofer is true, Args.SaveFDs contains only one FD, which
// is a socket connected to a checkpoint gofer.
SaveCheckpointGofer bool
// FSRestoreFDs are FDs used for filesystem checkpoint restore.
FSRestoreFDs []*fd.FD
// If FSRestoreCheckpointGofer is true, Args.FSRestoreFDs contains only one
// FD, which is a socket connected to a checkpoint gofer.
FSRestoreCheckpointGofer bool
// FSSaveFDs are FDs used for user-triggered filesystem checkpoint saving.
FSSaveFDs []*fd.FD
// If FSSaveCheckpointGofer is true, Args.FSSaveFDs contains only one FD,
// which is a socket connected to a checkpoint gofer.
FSSaveCheckpointGofer bool
// RootfsUpperTarFD is the file descriptor to the tar file containing the rootfs
// upper layer changes.
RootfsUpperTarFD int
}
Args are the arguments for New().
type BindOpt ¶
type BindOpt int
BindOpt indicates whether the sentry or runsc process is responsible for binding the AF_XDP socket.
type CPUUsage ¶
type CPUUsage struct {
Kernel uint64 `json:"kernel,omitempty"`
User uint64 `json:"user,omitempty"`
Total uint64 `json:"total,omitempty"`
PerCPU []uint64 `json:"percpu,omitempty"`
}
CPUUsage contains stats on CPU usage.
type ContainerRuntimeState ¶
type ContainerRuntimeState int
ContainerRuntimeState is the runtime state of a container.
const ( // RuntimeStateInvalid used just in case of error. RuntimeStateInvalid ContainerRuntimeState = iota // RuntimeStateCreating indicates that the container is being // created, but has not started running yet. RuntimeStateCreating // RuntimeStateRunning indicates that the container is running. RuntimeStateRunning // RuntimeStateStopped indicates that the container has stopped. RuntimeStateStopped )
type CreateArgs ¶
type CreateArgs struct {
// CID is the ID of the container to start.
CID string
// FilePayload may contain a TTY file for the terminal, if enabled.
urpc.FilePayload
}
CreateArgs contains arguments to the Create method.
type CreateLinksAndRoutesArgs ¶
type CreateLinksAndRoutesArgs struct {
// FilePayload contains the fds associated with the FDBasedLinks. The
// number of fd's should match the sum of the NumChannels field of the
// FDBasedLink entries below.
urpc.FilePayload
LoopbackLinks []LoopbackLink
FDBasedLinks []FDBasedLink
XDPLinks []XDPLink
Defaultv4Gateway DefaultRoute
Defaultv6Gateway DefaultRoute
// PCAP indicates that FilePayload also contains a PCAP log file.
PCAP bool
// LogPackets indicates that packets should be logged.
LogPackets bool
// NATBlob indicates whether FilePayload also contains an iptables NAT
// ruleset.
NATBlob bool
// PauseExternalNetworking indicates whether external networking should be
// disabled initially.
PauseExternalNetworking bool
// AllowConnectedOnSave indicates whether connections should be allowed to
// remain connected during save.
AllowConnectedOnSave bool
// IsRestore indicates whether this is part of a restore flow.
IsRestore bool
}
CreateLinksAndRoutesArgs are arguments to CreateLinkAndRoutes.
type CreateTraceSessionArgs ¶
type CreateTraceSessionArgs struct {
Config seccheck.SessionConfig
Force bool
urpc.FilePayload
}
CreateTraceSessionArgs are arguments to the CreateTraceSession method.
type DefaultRoute ¶
DefaultRoute represents a catch all route to the default gateway.
type Event ¶
Event struct for encoding the event data to JSON. Corresponds to runc's main.event struct.
type EventOut ¶
type EventOut struct {
Event Event `json:"event"`
// ContainerUsage maps each container ID to its total CPU usage.
ContainerUsage map[string]uint64 `json:"containerUsage"`
}
EventOut is the return type of the Event command.
type FDBasedLink ¶
type FDBasedLink struct {
Name string
InterfaceIndex int
MTU int
Addresses []IPWithPrefix
Routes []Route
GSOMaxSize uint32
GVisorGSOEnabled bool
GVisorGRO bool
TXChecksumOffload bool
RXChecksumOffload bool
LinkAddress net.HardwareAddr
QDisc config.QueueingDiscipline
TBFRate uint64
TBFBurst uint32
Neighbors []Neighbor
// NumChannels controls how many underlying FDs are to be used to
// create this endpoint.
NumChannels int
// ProcessorsPerChannel controls how many goroutines are used to handle
// packets on each channel.
ProcessorsPerChannel int
// IsPacket indicates whether each FD in this link is a packet socket.
IsPacket []bool
// PreConfigured indicates that getsockname and setsockopt(PACKET_FANOUT)
// have already been performed on the host FDs.
PreConfigured bool
}
FDBasedLink configures an fd-based link.
type FDMapping ¶
FDMapping is a helper type to represent a mapping from guest to host file descriptors. In contrast to the unexported fdMapping type, it does not imply file ownership.
type FSSaveArgs ¶
type FSSaveArgs struct {
// FilePayload contains the following fscheckpoint files in order:
// 1. manifest file
// 2. multi-tar file
// 3. pages metadata file
// 4. pages file
urpc.FilePayload
// Path is the path inside the container to save.
Path string `json:"path"`
// Equivalent to kernel.FSSaveOpts fields.
ExitAfterSaving bool `json:"exit_after_saving"`
// If UseCheckpointGofer is true, FSSaveArgs.FilePayload should contain
// exactly one FD, which is a Unix domain socket connected to a URPC server
// implementing stateipc.AsyncFileServer.
UseCheckpointGofer bool `json:"use_checkpoint_gofer"`
}
FSSaveArgs holds arguments to FSSave.
type HostTHP ¶
type HostTHP struct {
// ShmemEnabled is the selected option in
// /sys/kernel/mm/transparent_hugepage/shmem_enabled.
ShmemEnabled string
// Defrag is the selected option in
// /sys/kernel/mm/transparent_hugepage/defrag.
Defrag string
}
HostTHP holds host transparent hugepage settings.
type IPWithPrefix ¶
type IPWithPrefix struct {
// Address is a network address.
Address net.IP
// PrefixLen is the subnet prefix length.
PrefixLen int
}
IPWithPrefix is an address with its subnet prefix length.
func (IPWithPrefix) String ¶
func (ip IPWithPrefix) String() string
type InitConfig ¶
type InitConfig struct {
TraceSession seccheck.SessionConfig `json:"trace_session"`
}
InitConfig represents the configuration to apply during pod creation. For now, it supports setting up a seccheck session.
func LoadInitConfig ¶
func LoadInitConfig(path string) (*InitConfig, error)
LoadInitConfig loads an InitConfig struct from a json formatted file.
type InitPluginStackArgs ¶
type InitPluginStackArgs struct {
urpc.FilePayload
InitStr string
}
InitPluginStackArgs are arguments to InitPluginStack.
type Loader ¶
type Loader struct {
// PreSeccompCallback is called right before installing seccomp filters.
PreSeccompCallback func()
// contains filtered or unexported fields
}
Loader keeps state needed to start the kernel and run the container.
func New ¶
New initializes a new kernel loader configured by spec. New also handles setting up a kernel for restoring a container.
func (*Loader) ConfigureNetwork ¶
ConfigureNetwork implements inet.NetworkArgs.ConfigureNetwork.
func (*Loader) Destroy ¶
func (l *Loader) Destroy()
Destroy cleans up all resources used by the loader.
Note that this will block until all open control server connections have been closed. For that reason, this should NOT be called in a defer, because a panic in a control server rpc would then hang forever.
func (*Loader) GetContainerSpecs ¶
GetContainerSpecs returns the container specs map.
func (*Loader) SaveAsync ¶
SaveAsync starts a goroutine to save the kernel. Implements kernel.Saver.
func (*Loader) SpecEnviron ¶
SpecEnviron returns the environment variables for the given container from the container spec it was created with.
func (*Loader) WaitExit ¶
func (l *Loader) WaitExit() linux.WaitStatus
WaitExit waits for the root container to exit, and returns its exit status.
func (*Loader) WaitForStartSignal ¶
func (l *Loader) WaitForStartSignal()
WaitForStartSignal waits for a start signal from the control server.
type LoopbackLink ¶
type LoopbackLink struct {
Name string
Addresses []IPWithPrefix
Routes []Route
GVisorGRO bool
}
LoopbackLink configures a loopback link.
type Memory ¶
type Memory struct {
Cache uint64 `json:"cache,omitempty"`
Usage MemoryEntry `json:"usage,omitempty"`
Swap MemoryEntry `json:"swap,omitempty"`
Kernel MemoryEntry `json:"kernel,omitempty"`
KernelTCP MemoryEntry `json:"kernelTCP,omitempty"`
Raw map[string]uint64 `json:"raw,omitempty"`
}
Memory contains stats on memory.
type MemoryEntry ¶
type MemoryEntry struct {
Limit uint64 `json:"limit"`
Usage uint64 `json:"usage,omitempty"`
Max uint64 `json:"max,omitempty"`
Failcnt uint64 `json:"failcnt"`
}
MemoryEntry contains stats on a kind of memory.
type MountArgs ¶
type MountArgs struct {
// ContainerID is the container in which we will mount the filesystem.
ContainerID string
// Source is the mount source.
Source string
// Destination is the mount target.
Destination string
// FsType is the filesystem type.
FsType string
// FilePayload contains the source image FD, if required by the filesystem.
urpc.FilePayload
}
MountArgs contains arguments to the Mount method.
type MountHint ¶
type MountHint struct {
Name string `json:"name"`
Mount specs.Mount `json:"mount"`
// SuppressDirectFS suppresses the "directfs" gofer mount option for this
// mount even if --directfs is enabled globally. It does not enable directfs
// when --directfs is disabled because directfs requires some sandbox-wide
// settings (like seccomp filters) that can not be selectively enabled on
// containers.
SuppressDirectFS bool `json:"suppressDirectFS"`
}
MountHint represents extra information about mounts that are provided via annotations. They can override mount type, provide sharing information so that mounts can be correctly shared inside the pod, and tune gofer-specific behavior such as suppressing directfs. It is part of the sandbox.Sandbox struct, so it must be serializable.
func (*MountHint) IsSandboxLocal ¶
IsSandboxLocal returns true if this mount is only used by the sandbox and has no external observers.
func (*MountHint) ShouldShareMount ¶
ShouldShareMount returns true if this mount should be configured as a shared mount that is shared among multiple containers in a pod.
type Network ¶
type Network struct {
Stack *stack.Stack
Kernel *kernel.Kernel
// PluginStack is a third-party network stack to use in place of
// netstack when non-nil.
PluginStack plugin.PluginStack
}
Network exposes methods that can be used to configure a network stack.
func (*Network) CreateLinksAndRoutes ¶
func (n *Network) CreateLinksAndRoutes(args *CreateLinksAndRoutesArgs, _ *struct{}) error
CreateLinksAndRoutes creates links and routes in a network stack. It should only be called once.
func (*Network) InitPluginStack ¶
func (n *Network) InitPluginStack(args *InitPluginStackArgs, _ *struct{}) error
InitPluginStack initializes plugin network stack. It will invoke Init() that is registered by current plugin stack.
type NetworkInterface ¶
type NetworkInterface struct {
// Name is the name of the network interface.
Name string
RxBytes uint64
RxPackets uint64
RxErrors uint64
RxDropped uint64
TxBytes uint64
TxPackets uint64
TxErrors uint64
TxDropped uint64
}
NetworkInterface is the network statistics of the particular network interface
type Pids ¶
type Pids struct {
Current uint64 `json:"current,omitempty"`
Limit uint64 `json:"limit,omitempty"`
}
Pids contains stats on processes.
type PodMountHints ¶
PodMountHints contains a collection of mountHints for the pod.
func NewPodMountHints ¶
func NewPodMountHints(spec *specs.Spec) (*PodMountHints, error)
NewPodMountHints instantiates PodMountHints using spec.
func (*PodMountHints) FindMount ¶
func (p *PodMountHints) FindMount(mountSrc string) *MountHint
FindMount finds the MountHint that applies to this mount.
type PortForwardOpts ¶
type PortForwardOpts struct {
// FilePayload contains one fd for a UDS (or local port) used for port
// forwarding.
urpc.FilePayload
// ContainerID is the container for the process being executed.
ContainerID string
// Port is the port to to forward.
Port uint16
}
PortForwardOpts contains options for port forwarding to a port in a container.
type RestoreOpts ¶
type RestoreOpts struct {
// FilePayload contains, in order:
// 1. checkpoint state file.
// 2. optional checkpoint pages metadata file.
// 3. optional checkpoint pages file.
// 4. optional platform device file.
urpc.FilePayload
HavePagesFile bool
HaveDeviceFile bool
Background bool
// If UseCheckpointGofer is true, the first file in FilePayload is a Unix
// domain socket connected to a URPC server implementing
// stateipc.AsyncFileServer and providing checkpoint files. In this case,
// RestoreOpts.HavePagesFile is unknown and must be determined by
// containerManager.Restore.
UseCheckpointGofer bool `json:"use_checkpoint_gofer"`
}
RestoreOpts contains options related to restoring a container's file system.
type RootfsHint ¶
type RootfsHint struct {
Mount specs.Mount
Overlay config.OverlayMedium
// Size of overlay tmpfs. Passed as `size={Size}` to tmpfs mount.
// Use default if unspecified.
Size string
SuppressDirectFS bool
}
RootfsHint represents extra information about rootfs that are provided via annotations. They can provide mount source, mount type and overlay config.
func NewRootfsHint ¶
func NewRootfsHint(spec *specs.Spec) (*RootfsHint, error)
NewRootfsHint instantiates RootfsHint using spec.
type Savings ¶
type Savings struct {
// CPUTimeSaved is the CPU time saved at restore.
CPUTimeSaved gtime.Duration
// WallTimeSaved is the wall time saved at restore.
WallTimeSaved gtime.Duration
}
Savings holds the savings with restore.
type SignalArgs ¶
type SignalArgs struct {
// CID is the container ID.
CID string
// Signo is the signal to send to the process.
Signo int32
// PID is the process ID in the given container that will be signaled,
// relative to the root PID namespace, not the container's.
// If 0, the root container will be signalled.
PID int32
// Mode is the signal delivery mode.
Mode SignalDeliveryMode
}
SignalArgs are arguments to the Signal method.
type SignalDeliveryMode ¶
type SignalDeliveryMode int
SignalDeliveryMode enumerates different signal delivery modes.
const ( // DeliverToProcess delivers the signal to the container process with // the specified PID. If PID is 0, then the container init process is // signaled. DeliverToProcess SignalDeliveryMode = iota // DeliverToAllProcesses delivers the signal to all processes in the // container. PID must be 0. DeliverToAllProcesses // DeliverToForegroundProcessGroup delivers the signal to the // foreground process group in the same TTY session as the specified // process. If PID is 0, then the signal is delivered to the foreground // process group for the TTY for the init process. DeliverToForegroundProcessGroup // DeliverToProcessGroup delivers the signal to all processes in the // process group identified by a PGID. DeliverToProcessGroup )
func (SignalDeliveryMode) String ¶
func (s SignalDeliveryMode) String() string
type StartArgs ¶
type StartArgs struct {
// Spec is the spec of the container to start.
Spec *specs.Spec
// Config is the runsc-specific configuration for the sandbox.
Conf *config.Config
// CID is the ID of the container to start.
CID string
// NumGoferFilestoreFDs is the number of gofer filestore FDs donated.
NumGoferFilestoreFDs int
// IsDevIoFilePresent indicates whether the dev gofer FD is present.
IsDevIoFilePresent bool
// GoferMountConfs contains information about how the gofer mounts have been
// configured. The first entry is for rootfs and the following entries are
// for bind mounts in Spec.Mounts (in the same order).
GoferMountConfs []specutils.GoferMountConf
// IsRootfsUpperTarFilePresent indicates whether the rootfs upper tar file is present.
IsRootfsUpperTarFilePresent bool
// FilePayload contains, in order:
// * stdin, stdout, and stderr (optional: if terminal is disabled).
// * file descriptors to gofer-backing host files (optional).
// * file descriptor for /dev gofer connection (optional)
// * file descriptor for rootfs upper tar file (optional)
// * file descriptors to connect to gofer to serve the root filesystem.
urpc.FilePayload
}
StartArgs contains arguments to the Start method.
type Stats ¶
type Stats struct {
CPU CPU `json:"cpu"`
Memory Memory `json:"memory"`
Pids Pids `json:"pids"`
NetworkInterfaces []*NetworkInterface `json:"network_interfaces"`
}
Stats is the runc specific stats structure for stability when encoding and decoding stats.
type WaitFSRestoreArgs ¶
type WaitFSRestoreArgs struct {
// CID is the container ID.
CID string
}
WaitFSRestoreArgs holds arguments to containerManager.WaitFSRestore.
type WaitPIDArgs ¶
type WaitPIDArgs struct {
// PID is the PID in the container's PID namespace.
PID int32
// CID is the container ID.
CID string
}
WaitPIDArgs are arguments to the WaitPID method.
type XDPLink ¶
type XDPLink struct {
Name string
InterfaceIndex int
MTU int
Addresses []IPWithPrefix
Routes []Route
TXChecksumOffload bool
RXChecksumOffload bool
LinkAddress net.HardwareAddr
QDisc config.QueueingDiscipline
TBFRate uint64
TBFBurst uint32
Neighbors []Neighbor
GVisorGRO bool
Bind BindOpt
// NumChannels controls how many underlying FDs are to be used to
// create this endpoint.
NumChannels int
}
XDPLink configures an XDP link.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package filter installs seccomp filters to prevent prohibited syscalls in case it's compromised.
|
Package filter installs seccomp filters to prevent prohibited syscalls in case it's compromised. |
|
config
Package config defines all syscalls the sandbox is allowed to make to the host.
|
Package config defines all syscalls the sandbox is allowed to make to the host. |
|
dumpfilter
command
dumpfilter dumps the seccomp-bpf program used by the Sentry.
|
dumpfilter dumps the seccomp-bpf program used by the Sentry. |
|
Package portforward holds the infrastructure to support the port forward command.
|
Package portforward holds the infrastructure to support the port forward command. |
|
Package pprof provides a stub to initialize custom profilers.
|
Package pprof provides a stub to initialize custom profilers. |
|
Package procfs holds utilities for getting procfs information for sandboxed processes.
|
Package procfs holds utilities for getting procfs information for sandboxed processes. |