Documentation
¶
Overview ¶
Package runner provides a runner for running services.
Index ¶
- Constants
- func WithMemoryReservation(limit uint64) oci.SpecOpts
- type Args
- type IOPriorityParam
- type Option
- func WithCgroupPath(path string) Option
- func WithContainerImage(o string) Option
- func WithContainerOpts(o ...containerd.NewContainerOpts) Option
- func WithContainerdAddress(a string) Option
- func WithCtty(ctty int) Option
- func WithCustomSeccompProfile(override func(*specs.LinuxSeccomp)) Option
- func WithDroppedCapabilities(caps map[string]struct{}) Option
- func WithEnv(o []string) Option
- func WithGracefulShutdownTimeout(timeout time.Duration) Option
- func WithIOPriority(class, priority uint) Option
- func WithLoggingManager(manager runtime.LoggingManager) Option
- func WithNamespace(o string) Option
- func WithOCISpecOpts(o ...oci.SpecOpts) Option
- func WithOOMScoreAdj(score int) Option
- func WithPriority(priority int) Option
- func WithSchedulingPolicy(policy uint) Option
- func WithSelinuxLabel(label string) Option
- func WithStderrFile(path string) Option
- func WithStdin(stdin io.ReadSeeker) Option
- func WithStdinFile(path string) Option
- func WithStdoutFile(path string) Option
- func WithUID(uid uint32) Option
- type Options
- type Runner
Constants ¶
const ( // IoprioClassNone represents IOPRIO_CLASS_NONE. IoprioClassNone = iota // IoprioClassRt represents IOPRIO_CLASS_RT. IoprioClassRt // IoprioClassBe represents IOPRIO_CLASS_BE. IoprioClassBe // IoprioClassIdle represents IOPRIO_CLASS_IDLE. IoprioClassIdle )
const ( // SchedulingPolicyNormal represents SCHED_NORMAL. SchedulingPolicyNormal = iota // SchedulingPolicyFIFO represents SCHED_FIFO. SchedulingPolicyFIFO // SchedulingPolicyRR represents SCHED_RR. SchedulingPolicyRR // SchedulingPolicyBatch represents SCHED_BATCH. SchedulingPolicyBatch // SchedulingPolicyIsoUnimplemented represents SCHED_ISO. SchedulingPolicyIsoUnimplemented // SchedulingPolicyIdle represents SCHED_IDLE. SchedulingPolicyIdle // SchedulingPolicyDeadline represents SCHED_DEADLINE. SchedulingPolicyDeadline )
Variables ¶
This section is empty.
Functions ¶
func WithMemoryReservation ¶
WithMemoryReservation sets the memory reservation limit as on OCI spec.
Types ¶
type IOPriorityParam ¶
IOPriorityParam represents the combination of IO scheduling class and priority.
type Option ¶
type Option func(*Options)
Option is the functional option func.
func WithContainerImage ¶
WithContainerImage sets the image ref.
func WithContainerOpts ¶
func WithContainerOpts(o ...containerd.NewContainerOpts) Option
WithContainerOpts sets the containerd container options.
func WithContainerdAddress ¶
WithContainerdAddress sets the containerd socket path.
func WithCustomSeccompProfile ¶
func WithCustomSeccompProfile(override func(*specs.LinuxSeccomp)) Option
WithCustomSeccompProfile sets the function to override seccomp profile.
func WithDroppedCapabilities ¶
WithDroppedCapabilities sets the list of capabilities to drop.
func WithGracefulShutdownTimeout ¶
WithGracefulShutdownTimeout sets the timeout for the task to terminate before sending SIGKILL.
func WithIOPriority ¶
WithIOPriority sets the IO priority and class of the process.
func WithLoggingManager ¶
func WithLoggingManager(manager runtime.LoggingManager) Option
WithLoggingManager sets the LoggingManager option.
func WithOCISpecOpts ¶
WithOCISpecOpts sets the OCI spec options.
func WithOOMScoreAdj ¶
WithOOMScoreAdj sets the oom_score_adj.
func WithPriority ¶
WithPriority sets the priority of the process.
func WithSchedulingPolicy ¶
WithSchedulingPolicy sets the scheduling policy of the process.
func WithSelinuxLabel ¶
WithSelinuxLabel sets the SELinux label.
func WithStderrFile ¶
WithStderrFile sets the path to the file to use as stderr.
func WithStdinFile ¶
WithStdinFile sets the path to the file to use as stdin.
func WithStdoutFile ¶
WithStdoutFile sets the path to the file to use as stdout.
type Options ¶
type Options struct {
// LoggingManager provides service log handling.
LoggingManager runtime.LoggingManager
// Env describes the service's environment variables. Elements should be in
// the format <key=<value>
Env []string
// ContainerdAddress is containerd socket address.
ContainerdAddress string
// ContainerOpts describes the container options.
ContainerOpts []containerd.NewContainerOpts
// OCISpecOpts describes the OCI spec options.
OCISpecOpts []oci.SpecOpts
// ContainerImage is the container's image.
ContainerImage string
// Namespace is the containerd namespace.
Namespace string
// GracefulShutdownTimeout is the time to wait for process to exit after SIGTERM
// before sending SIGKILL
GracefulShutdownTimeout time.Duration
// Stdin is the process standard input.
Stdin io.ReadSeeker
// Specify an oom_score_adj for the process.
OOMScoreAdj int
// CgroupPath (optional) sets the cgroup path to use
CgroupPath string
// OverrideSeccompProfile default Linux seccomp profile.
OverrideSeccompProfile func(*specs.LinuxSeccomp)
// DroppedCapabilities is the list of capabilities to drop.
DroppedCapabilities []string
// SelinuxLabel is the SELinux label to be assigned
SelinuxLabel string
// StdinFile is the path to the file to use as stdin.
StdinFile string
// StdoutFile is the path to the file to use as stdout.
StdoutFile string
// StderrFile is the path to the file to use as stderr.
StderrFile string
// Ctty is the controlling tty.
Ctty optional.Optional[int]
// UID is the user id of the process.
UID uint32
// Priority is the niceness value of the process.
Priority int
// IOPriority is the IO priority value and class of the process.
IOPriority optional.Optional[IOPriorityParam]
// SchedulingPolicy is the scheduling policy of the process.
SchedulingPolicy optional.Optional[uint]
}
Options is the functional options struct.
func DefaultOptions ¶
func DefaultOptions() *Options
DefaultOptions describes the default options to a runner.