Documentation ¶
Index ¶
- Constants
- Variables
- func ErrWithMessagef(err error, format string, args ...interface{}) error
- func IncrementRestart(ctx context.Context, client *containerd.Client, c *containers.Container) error
- func IsNotFound(err error) bool
- func WithLifecycleExtension(ctx context.Context, client *containerd.Client, c *containers.Container) error
- func WithPipeExtension(pipe PipeSet) containerd.NewContainerOpts
- type ContainerLifecycle
- type PipeFromStdout
- type PipeSet
- type PipeToStdin
- type RestartPolicy
Constants ¶
const ( // Always is default restart policy what means that every time when container stops, it should be restarted. Always = iota // OnFailure means that only if process fails (non zero exit code) the container should be restarted OnFailure )
Variables ¶
var (
ErrNotFound = errors.New("not found")
)
Definitions of common error types from extensions
Functions ¶
func ErrWithMessagef ¶ added in v0.2.8
ErrWithMessagef updates error message with formated message I.e. errors.WithMessage(err, fmt.Sprintf(... Hopefully we can change to errors.WithMessagef some day: https://github.com/pkg/errors/pull/118
func IncrementRestart ¶
func IncrementRestart(ctx context.Context, client *containerd.Client, c *containers.Container) error
IncrementRestart is containerd.UpdateContainerOpts implementation what increments restart counter
func IsNotFound ¶ added in v0.2.8
IsNotFound returns true if the error is due to a missing resource
func WithLifecycleExtension ¶
func WithLifecycleExtension(ctx context.Context, client *containerd.Client, c *containers.Container) error
WithLifecycleExtension is containerd.NewContainerOpts implementation what add lifecycle extension data to the container object.
func WithPipeExtension ¶
func WithPipeExtension(pipe PipeSet) containerd.NewContainerOpts
WithPipeExtension appends pipe extension data to the container object.
Types ¶
type ContainerLifecycle ¶
type ContainerLifecycle struct { // StartCount gets incremented on every time when container get started // If value is zero, assumed that it's not yet created StartCount int RestartPolicy RestartPolicy }
ContainerLifecycle contains all lifecycle related information like restart counter and restart policy.
func GetLifecycleExtension ¶
func GetLifecycleExtension(c containers.Container) (ContainerLifecycle, error)
GetLifecycleExtension returns ContainerLifecycle from container extensions or nil if not defined
type PipeFromStdout ¶
type PipeFromStdout struct {
Stdin PipeToStdin
}
PipeFromStdout defines container stdout as source for the piping
type PipeSet ¶
type PipeSet struct {
Stdout PipeFromStdout
}
PipeSet allows defining pipe from some source(s) to another container
func GetPipeExtension ¶
func GetPipeExtension(container containers.Container) (*PipeSet, error)
GetPipeExtension returns PipeSet from container extensions or nil if not defined
type PipeToStdin ¶
type PipeToStdin struct {
Name string
}
PipeToStdin defines container stdin as target for the piping
type RestartPolicy ¶
type RestartPolicy int
RestartPolicy describes policy for restarting th econtainer
func (RestartPolicy) String ¶
func (p RestartPolicy) String() string