Documentation
¶
Overview ¶
Package tasks provides an API for supervising system processes as Task's. It provides stronger guarantees with respect to process lifecycle than a standalone kubelet running static pods.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Completion ¶
type Completion struct {
// contains filtered or unexported fields
}
Completion represents the termination of a Task process. Each process execution should yield (barring drops because of an abort signal) exactly one Completion.
type Events ¶
type Events interface {
// Close stops delivery of events in the completion and errors channels; callers must close this when they intend to no longer read from completion() or errors()
Close() Events
// Completion reports Completion events as they happen
Completion() <-chan *Completion
// Done returns a signal chan that closes when all tasks have completed and there are no more events to deliver
Done() <-chan struct{}
}
func MergeOutput ¶
func MergeOutput(tasks []*Task, shouldQuit <-chan struct{}) Events
MergeOutput waits for the given tasks to complete. meanwhile it logs each time a task process completes or generates an error. when shouldQuit closes, tasks are canceled and this func eventually returns once all ongoing event handlers have completed running.
type Option ¶ added in v1.2.0
type Option func(*Task) Option
Option is a functional option type for a Task that returns an "undo" Option after upon modifying the Task
func Environment ¶ added in v1.2.0
func Environment(env []string) Option
Environment customizes the process runtime environment for a Task
type Task ¶
type Task struct {
Env []string // optional: process environment override
Finished func(restarting bool) bool // callback invoked when a task process has completed; if `restarting` then it will be restarted if it returns true
RestartDelay time.Duration // interval between repeated task restarts
// contains filtered or unexported fields
}
task is a specification for running a system process; it provides hooks for customizing logging and restart handling as well as provides event channels for communicating process termination and errors related to process management.