cruntime

package
v0.34.1 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package cruntime contains code specific to container runtimes

Index

Constants

View Source
const MinikubeContainerPrefix = "k8s_"

Variables

This section is empty.

Functions

This section is empty.

Types

type CRIO

type CRIO struct {
	Socket string
	Runner CommandRunner
}

CRIO contains CRIO runtime state

func (*CRIO) Active

func (r *CRIO) Active() bool

Active returns if CRIO is active on the host

func (*CRIO) Available

func (r *CRIO) Available() error

Available returns an error if it is not possible to use this runtime on a host

func (*CRIO) ContainerLogCmd

func (r *CRIO) ContainerLogCmd(id string, len int, follow bool) string

ContainerLogCmd returns the command to retrieve the log for a container based on ID

func (*CRIO) DefaultCNI

func (r *CRIO) DefaultCNI() bool

DefaultCNI returns whether to use CNI networking by default

func (*CRIO) Disable

func (r *CRIO) Disable() error

Disable idempotently disables CRIO on a host

func (*CRIO) Enable

func (r *CRIO) Enable() error

Enable idempotently enables CRIO on a host

func (*CRIO) KillContainers

func (r *CRIO) KillContainers(ids []string) error

KillContainers removes containers based on ID

func (*CRIO) KubeletOptions

func (r *CRIO) KubeletOptions() map[string]string

KubeletOptions returns kubelet options for a runtime.

func (*CRIO) ListContainers

func (r *CRIO) ListContainers(filter string) ([]string, error)

ListContainers returns a list of managed by this container runtime

func (*CRIO) LoadImage

func (r *CRIO) LoadImage(path string) error

LoadImage loads an image into this runtime

func (*CRIO) Name

func (r *CRIO) Name() string

Name is a human readable name for CRIO

func (*CRIO) SocketPath

func (r *CRIO) SocketPath() string

SocketPath returns the path to the socket file for CRIO

func (*CRIO) StopContainers

func (r *CRIO) StopContainers(ids []string) error

StopContainers stops containers based on ID

type CommandRunner

type CommandRunner interface {
	Run(string) error
	CombinedOutput(string) (string, error)
}

CommandRunner is the subset of bootstrapper.CommandRunner this package consumes

type Config

type Config struct {
	// Type of runtime to create ("docker, "crio", etc)
	Type string
	// Custom path to a socket file
	Socket string
	// Runner is the CommandRunner object to execute commands with
	Runner CommandRunner
}

Config is runtime configuration

type Containerd

type Containerd struct {
	Socket string
	Runner CommandRunner
}

Containerd contains containerd runtime state

func (*Containerd) Active

func (r *Containerd) Active() bool

Active returns if containerd is active on the host

func (*Containerd) Available

func (r *Containerd) Available() error

Available returns an error if it is not possible to use this runtime on a host

func (*Containerd) ContainerLogCmd

func (r *Containerd) ContainerLogCmd(id string, len int, follow bool) string

ContainerLogCmd returns the command to retrieve the log for a container based on ID

func (*Containerd) DefaultCNI

func (r *Containerd) DefaultCNI() bool

DefaultCNI returns whether to use CNI networking by default

func (*Containerd) Disable

func (r *Containerd) Disable() error

Disable idempotently disables containerd on a host

func (*Containerd) Enable

func (r *Containerd) Enable() error

Enable idempotently enables containerd on a host

func (*Containerd) KillContainers

func (r *Containerd) KillContainers(ids []string) error

KillContainers removes containers based on ID

func (*Containerd) KubeletOptions

func (r *Containerd) KubeletOptions() map[string]string

KubeletOptions returns kubelet options for a containerd

func (*Containerd) ListContainers

func (r *Containerd) ListContainers(filter string) ([]string, error)

ListContainers returns a list of managed by this container runtime

func (*Containerd) LoadImage

func (r *Containerd) LoadImage(path string) error

LoadImage loads an image into this runtime

func (*Containerd) Name

func (r *Containerd) Name() string

Name is a human readable name for containerd

func (*Containerd) SocketPath

func (r *Containerd) SocketPath() string

SocketPath returns the path to the socket file for containerd

func (*Containerd) StopContainers

func (r *Containerd) StopContainers(ids []string) error

StopContainers stops containers based on ID

type Docker

type Docker struct {
	Socket string
	Runner CommandRunner
}

Docker contains Docker runtime state

func (*Docker) Active

func (r *Docker) Active() bool

Active returns if docker is active on the host

func (*Docker) Available

func (r *Docker) Available() error

Available returns an error if it is not possible to use this runtime on a host

func (*Docker) ContainerLogCmd

func (r *Docker) ContainerLogCmd(id string, len int, follow bool) string

ContainerLogCmd returns the command to retrieve the log for a container based on ID

func (*Docker) DefaultCNI

func (r *Docker) DefaultCNI() bool

DefaultCNI returns whether to use CNI networking by default

func (*Docker) Disable

func (r *Docker) Disable() error

Disable idempotently disables Docker on a host

func (*Docker) Enable

func (r *Docker) Enable() error

Enable idempotently enables Docker on a host

func (*Docker) KillContainers

func (r *Docker) KillContainers(ids []string) error

KillContainers forcibly removes a running container based on ID

func (*Docker) KubeletOptions

func (r *Docker) KubeletOptions() map[string]string

KubeletOptions returns kubelet options for a runtime.

func (*Docker) ListContainers

func (r *Docker) ListContainers(filter string) ([]string, error)

ListContainers returns a list of containers

func (*Docker) LoadImage

func (r *Docker) LoadImage(path string) error

LoadImage loads an image into this runtime

func (*Docker) Name

func (r *Docker) Name() string

Name is a human readable name for Docker

func (*Docker) SocketPath

func (r *Docker) SocketPath() string

SocketPath returns the path to the socket file for Docker

func (*Docker) StopContainers

func (r *Docker) StopContainers(ids []string) error

StopContainers stops a running container based on ID

type Manager

type Manager interface {
	// Name is a human readable name for a runtime
	Name() string
	// Enable idempotently enables this runtime on a host
	Enable() error
	// Disable idempotently disables this runtime on a host
	Disable() error
	// Active returns whether or not a runtime is active on a host
	Active() bool
	// Available returns an error if it is not possible to use this runtime on a host
	Available() error

	// KubeletOptions returns kubelet options for a runtime.
	KubeletOptions() map[string]string
	// SocketPath returns the path to the socket file for a given runtime
	SocketPath() string
	// DefaultCNI returns whether to use CNI networking by default
	DefaultCNI() bool

	// Load an image idempotently into the runtime on a host
	LoadImage(string) error

	// ListContainers returns a list of managed by this container runtime
	ListContainers(string) ([]string, error)
	// KillContainers removes containers based on ID
	KillContainers([]string) error
	// StopContainers stops containers based on ID
	StopContainers([]string) error
	// ContainerLogCmd returns the command to retrieve the log for a container based on ID
	ContainerLogCmd(string, int, bool) string
}

Manager is a common interface for container runtimes

func New

func New(c Config) (Manager, error)

New returns an appropriately configured runtime

type Rkt

type Rkt struct {
	Socket string
	Runner CommandRunner
}

Rkt contains rkt runtime state

func (*Rkt) Active

func (r *Rkt) Active() bool

Active returns if rkt is active on the host

func (*Rkt) Available

func (r *Rkt) Available() error

Available returns an error if it is not possible to use this runtime on a host

func (*Rkt) ContainerLogCmd

func (r *Rkt) ContainerLogCmd(id string, len int, follow bool) string

ContainerLogCmd returns the command to retrieve the log for a container based on ID

func (*Rkt) DefaultCNI

func (r *Rkt) DefaultCNI() bool

DefaultCNI returns whether to use CNI networking by default

func (*Rkt) Disable

func (r *Rkt) Disable() error

Disable idempotently disables rkt on a host

func (*Rkt) Enable

func (r *Rkt) Enable() error

Enable idempotently enables rkt on a host

func (*Rkt) KillContainers

func (r *Rkt) KillContainers(ids []string) error

KillContainers removes containers based on ID

func (*Rkt) KubeletOptions

func (r *Rkt) KubeletOptions() map[string]string

KubeletOptions returns kubelet options for a rkt

func (*Rkt) ListContainers

func (r *Rkt) ListContainers(filter string) ([]string, error)

ListContainers returns a list of managed by this container runtime

func (*Rkt) LoadImage

func (r *Rkt) LoadImage(path string) error

LoadImage loads an image into this runtime

func (*Rkt) Name

func (r *Rkt) Name() string

Name is a human readable name for rkt

func (*Rkt) SocketPath

func (r *Rkt) SocketPath() string

SocketPath returns the path to the socket file for rkt/rktlet

func (*Rkt) StopContainers

func (r *Rkt) StopContainers(ids []string) error

StopContainers stops containers based on ID

Jump to

Keyboard shortcuts

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