Documentation ¶
Index ¶
- Variables
- func ErrWithMessagef(err error, format string, args ...interface{}) error
- func IsNotFound(err error) bool
- type AttachIO
- type Client
- type ContainerdClient
- func (c *ContainerdClient) Attach(namespace, name string, io AttachIO) error
- func (c *ContainerdClient) CreateContainer(pod model.Pod, container model.Container) (status model.ContainerStatus, err error)
- func (c *ContainerdClient) Exec(namespace, name, id string, args []string, tty bool, io AttachIO) error
- func (c *ContainerdClient) GetContainerTaskStatus(namespace, name string) string
- func (c *ContainerdClient) GetNamespaces() ([]string, error)
- func (c *ContainerdClient) GetPod(namespace, podName string) (model.Pod, error)
- func (c *ContainerdClient) GetPods(namespace string) ([]model.Pod, error)
- func (c *ContainerdClient) IsContainerRunning(namespace, name string) (bool, error)
- func (c *ContainerdClient) PullImage(namespace, ref string, progress *progress.ImageFetch) error
- func (c *ContainerdClient) Signal(namespace, name string, signal syscall.Signal) error
- func (c *ContainerdClient) StartContainer(namespace, id string, ioSet IOSet) (result model.ContainerStatus, err error)
- func (c *ContainerdClient) StopContainer(namespace, name string) (result model.ContainerStatus, err error)
- type IOSet
Constants ¶
This section is empty.
Variables ¶
var ( ErrNotFound = errors.New("not found") ErrAlreadyExists = errors.New("already exists") ErrNotSupported = errors.New("not supported") )
Definitions of common error types used throughout runtime implementation. All errors returned by the interface will map into one of these errors classes.
Functions ¶
func ErrWithMessagef ¶
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 IsNotFound ¶
IsNotFound returns true if the error is due to a missing resource
Types ¶
type Client ¶
type Client interface { GetPods(namespace string) ([]model.Pod, error) GetPod(namespace, podName string) (model.Pod, error) PullImage(namespace, ref string, status *progress.ImageFetch) error CreateContainer(pod model.Pod, container model.Container) (model.ContainerStatus, error) StartContainer(namespace, id string, io IOSet) (model.ContainerStatus, error) StopContainer(namespace, id string) (model.ContainerStatus, error) GetNamespaces() ([]string, error) IsContainerRunning(namespace, name string) (bool, error) GetContainerTaskStatus(namespace, name string) string Exec(namespace, podName, execID string, args []string, tty bool, attach AttachIO) error Attach(namespace, podName string, attach AttachIO) error Signal(namespace, name string, signal syscall.Signal) error }
Client is interface for underlying container implementation
type ContainerdClient ¶
type ContainerdClient struct {
// contains filtered or unexported fields
}
ContainerdClient is containerd client wrapper
func NewContainerdClient ¶
func NewContainerdClient(context context.Context, timeout time.Duration, address, hostname string) *ContainerdClient
NewContainerdClient creates new containerd client with given timeout
func (*ContainerdClient) Attach ¶
func (c *ContainerdClient) Attach(namespace, name string, io AttachIO) error
Attach hook IO to container main process
func (*ContainerdClient) CreateContainer ¶
func (c *ContainerdClient) CreateContainer(pod model.Pod, container model.Container) (status model.ContainerStatus, err error)
CreateContainer creates given container
func (*ContainerdClient) Exec ¶ added in v0.2.3
func (c *ContainerdClient) Exec(namespace, name, id string, args []string, tty bool, io AttachIO) error
Exec run command in container and hook IO to the new process
func (*ContainerdClient) GetContainerTaskStatus ¶
func (c *ContainerdClient) GetContainerTaskStatus(namespace, name string) string
GetContainerTaskStatus resolves container status or return UNKNOWN
func (*ContainerdClient) GetNamespaces ¶
func (c *ContainerdClient) GetNamespaces() ([]string, error)
GetNamespaces return all namespaces
func (*ContainerdClient) GetPod ¶
func (c *ContainerdClient) GetPod(namespace, podName string) (model.Pod, error)
GetPod return pod by name
func (*ContainerdClient) GetPods ¶
func (c *ContainerdClient) GetPods(namespace string) ([]model.Pod, error)
GetPods return all containers active in containerd grouped by pods
func (*ContainerdClient) IsContainerRunning ¶
func (c *ContainerdClient) IsContainerRunning(namespace, name string) (bool, error)
IsContainerRunning returns true if container running. If cannot resolve, return false with error
func (*ContainerdClient) PullImage ¶
func (c *ContainerdClient) PullImage(namespace, ref string, progress *progress.ImageFetch) error
PullImage ensures that given container image is pulled to the namespace
func (*ContainerdClient) Signal ¶
func (c *ContainerdClient) Signal(namespace, name string, signal syscall.Signal) error
Signal will send a syscall.Signal to the container task process
func (*ContainerdClient) StartContainer ¶
func (c *ContainerdClient) StartContainer(namespace, id string, ioSet IOSet) (result model.ContainerStatus, err error)
StartContainer starts the pre-created container
func (*ContainerdClient) StopContainer ¶
func (c *ContainerdClient) StopContainer(namespace, name string) (result model.ContainerStatus, err error)
StopContainer stops given container