extensions

package
v0.2.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
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

View Source
var (
	ErrNotFound = errors.New("not found")
)

Definitions of common error types from extensions

Functions

func ErrWithMessagef added in v0.2.8

func ErrWithMessagef(err error, format string, args ...interface{}) error

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

func IsNotFound(err error) bool

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL