Documentation
¶
Overview ¶
Package cruntime contains code specific to container runtimes
Index ¶
- Constants
- func ContainerStatusCommand() string
- func UpdateCRIONet(r CommandRunner, cidr string) error
- func ValidRuntimes() []string
- type CRIO
- func (r *CRIO) Active() bool
- func (r *CRIO) Available() error
- func (r *CRIO) CGroupDriver() (string, error)
- func (r *CRIO) ContainerLogCmd(id string, len int, follow bool) string
- func (r *CRIO) Disable() error
- func (r *CRIO) Enable(disOthers, _ bool) error
- func (r *CRIO) ImageExists(name string, sha string) bool
- func (r *CRIO) ImagesPreloaded(images []string) bool
- func (r *CRIO) KillContainers(ids []string) error
- func (r *CRIO) KubeletOptions() map[string]string
- func (r *CRIO) ListContainers(o ListOptions) ([]string, error)
- func (r *CRIO) LoadImage(path string) error
- func (r *CRIO) Name() string
- func (r *CRIO) PauseContainers(ids []string) error
- func (r *CRIO) Preload(cfg config.KubernetesConfig) error
- func (r *CRIO) SocketPath() string
- func (r *CRIO) StopContainers(ids []string) error
- func (r *CRIO) Style() out.StyleEnum
- func (r *CRIO) SystemLogCmd(len int) string
- func (r *CRIO) UnpauseContainers(ids []string) error
- func (r *CRIO) Version() (string, error)
- type CommandRunner
- type Config
- type ContainerState
- type Containerd
- func (r *Containerd) Active() bool
- func (r *Containerd) Available() error
- func (r *Containerd) CGroupDriver() (string, error)
- func (r *Containerd) ContainerLogCmd(id string, len int, follow bool) string
- func (r *Containerd) Disable() error
- func (r *Containerd) Enable(disOthers, _ bool) error
- func (r *Containerd) ImageExists(name string, sha string) bool
- func (r *Containerd) ImagesPreloaded(images []string) bool
- func (r *Containerd) KillContainers(ids []string) error
- func (r *Containerd) KubeletOptions() map[string]string
- func (r *Containerd) ListContainers(o ListOptions) ([]string, error)
- func (r *Containerd) LoadImage(path string) error
- func (r *Containerd) Name() string
- func (r *Containerd) PauseContainers(ids []string) error
- func (r *Containerd) Preload(cfg config.KubernetesConfig) error
- func (r *Containerd) Restart() error
- func (r *Containerd) SocketPath() string
- func (r *Containerd) StopContainers(ids []string) error
- func (r *Containerd) Style() out.StyleEnum
- func (r *Containerd) SystemLogCmd(len int) string
- func (r *Containerd) UnpauseContainers(ids []string) error
- func (r *Containerd) Version() (string, error)
- type Docker
- func (r *Docker) Active() bool
- func (r *Docker) Available() error
- func (r *Docker) CGroupDriver() (string, error)
- func (r *Docker) ContainerLogCmd(id string, len int, follow bool) string
- func (r *Docker) Disable() error
- func (r *Docker) Enable(disOthers, forceSystemd bool) error
- func (r *Docker) ImageExists(name string, sha string) bool
- func (r *Docker) ImagesPreloaded(images []string) bool
- func (r *Docker) KillContainers(ids []string) error
- func (r *Docker) KubeletOptions() map[string]string
- func (r *Docker) ListContainers(o ListOptions) ([]string, error)
- func (r *Docker) LoadImage(path string) error
- func (r *Docker) Name() string
- func (r *Docker) PauseContainers(ids []string) error
- func (r *Docker) Preload(cfg config.KubernetesConfig) error
- func (r *Docker) Restart() error
- func (r *Docker) SocketPath() string
- func (r *Docker) StopContainers(ids []string) error
- func (r *Docker) Style() out.StyleEnum
- func (r *Docker) SystemLogCmd(len int) string
- func (r *Docker) UnpauseContainers(ids []string) error
- func (r *Docker) Version() (string, error)
- type ErrISOFeature
- type ListOptions
- type Manager
Constants ¶
const KubernetesContainerPrefix = "k8s_"
KubernetesContainerPrefix is the prefix of each Kubernetes container
Variables ¶
This section is empty.
Functions ¶
func ContainerStatusCommand ¶ added in v1.7.0
func ContainerStatusCommand() string
ContainerStatusCommand works across container runtimes with good formatting
func UpdateCRIONet ¶ added in v1.12.0
func UpdateCRIONet(r CommandRunner, cidr string) error
UpdateCRIONet updates CRIO CNI network configuration and restarts it
func ValidRuntimes ¶ added in v1.12.0
func ValidRuntimes() []string
ValidRuntimes lists the supported container runtimes
Types ¶
type CRIO ¶
type CRIO struct { Socket string Runner CommandRunner ImageRepository string KubernetesVersion semver.Version Init sysinit.Manager }
CRIO contains CRIO runtime state
func (*CRIO) Available ¶
Available returns an error if it is not possible to use this runtime on a host
func (*CRIO) CGroupDriver ¶ added in v1.7.0
CGroupDriver returns cgroup driver ("cgroupfs" or "systemd")
func (*CRIO) ContainerLogCmd ¶
ContainerLogCmd returns the command to retrieve the log for a container based on ID
func (*CRIO) ImageExists ¶ added in v1.6.0
ImageExists checks if an image exists
func (*CRIO) ImagesPreloaded ¶ added in v1.12.3
func (*CRIO) KillContainers ¶
KillContainers removes containers based on ID
func (*CRIO) KubeletOptions ¶
KubeletOptions returns kubelet options for a runtime.
func (*CRIO) ListContainers ¶
func (r *CRIO) ListContainers(o ListOptions) ([]string, error)
ListContainers returns a list of managed by this container runtime
func (*CRIO) PauseContainers ¶ added in v1.7.0
PauseContainers pauses a running container based on ID
func (*CRIO) Preload ¶ added in v1.8.0
func (r *CRIO) Preload(cfg config.KubernetesConfig) error
Preload preloads the container runtime with k8s images
func (*CRIO) SocketPath ¶
SocketPath returns the path to the socket file for CRIO
func (*CRIO) StopContainers ¶
StopContainers stops containers based on ID
func (*CRIO) SystemLogCmd ¶ added in v1.3.0
SystemLogCmd returns the command to retrieve system logs
func (*CRIO) UnpauseContainers ¶ added in v1.7.0
UnpauseContainers unpauses a running container based on ID
type CommandRunner ¶
type CommandRunner interface { RunCmd(cmd *exec.Cmd) (*command.RunResult, error) // Copy is a convenience method that runs a command to copy a file Copy(assets.CopyableFile) error // Remove is a convenience method that runs a command to remove a file Remove(assets.CopyableFile) error }
CommandRunner is the subset of command.Runner 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 // ImageRepository image repository to download image from ImageRepository string // KubernetesVersion Kubernetes version KubernetesVersion semver.Version }
Config is runtime configuration
type ContainerState ¶ added in v1.7.0
type ContainerState int
ContainerState is the run state of a container
const ( // All is all of the states All ContainerState = iota // Running is only running Running // Paused is only paused Paused )
func (ContainerState) String ¶ added in v1.7.0
func (cs ContainerState) String() string
type Containerd ¶
type Containerd struct { Socket string Runner CommandRunner ImageRepository string KubernetesVersion semver.Version Init sysinit.Manager }
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) CGroupDriver ¶ added in v1.7.0
func (r *Containerd) CGroupDriver() (string, error)
CGroupDriver returns cgroup driver ("cgroupfs" or "systemd")
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) Disable ¶
func (r *Containerd) Disable() error
Disable idempotently disables containerd on a host
func (*Containerd) Enable ¶
func (r *Containerd) Enable(disOthers, _ bool) error
Enable idempotently enables containerd on a host
func (*Containerd) ImageExists ¶ added in v1.6.0
func (r *Containerd) ImageExists(name string, sha string) bool
ImageExists checks if an image exists, expected input format
func (*Containerd) ImagesPreloaded ¶ added in v1.12.3
func (r *Containerd) ImagesPreloaded(images []string) bool
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(o ListOptions) ([]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) PauseContainers ¶ added in v1.7.0
func (r *Containerd) PauseContainers(ids []string) error
PauseContainers pauses a running container based on ID
func (*Containerd) Preload ¶ added in v1.8.0
func (r *Containerd) Preload(cfg config.KubernetesConfig) error
Preload preloads the container runtime with k8s images
func (*Containerd) Restart ¶ added in v1.10.0
func (r *Containerd) Restart() error
Restart restarts Docker on a host
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
func (*Containerd) Style ¶ added in v1.1.1
func (r *Containerd) Style() out.StyleEnum
Style is the console style for containerd
func (*Containerd) SystemLogCmd ¶ added in v1.3.0
func (r *Containerd) SystemLogCmd(len int) string
SystemLogCmd returns the command to retrieve system logs
func (*Containerd) UnpauseContainers ¶ added in v1.7.0
func (r *Containerd) UnpauseContainers(ids []string) error
UnpauseContainers unpauses a running container based on ID
func (*Containerd) Version ¶ added in v1.0.0
func (r *Containerd) Version() (string, error)
Version retrieves the current version of this runtime
type Docker ¶
type Docker struct { Socket string Runner CommandRunner Init sysinit.Manager }
Docker contains Docker runtime state
func (*Docker) Available ¶
Available returns an error if it is not possible to use this runtime on a host
func (*Docker) CGroupDriver ¶ added in v1.7.0
CGroupDriver returns cgroup driver ("cgroupfs" or "systemd")
func (*Docker) ContainerLogCmd ¶
ContainerLogCmd returns the command to retrieve the log for a container based on ID
func (*Docker) ImageExists ¶ added in v1.6.0
ImageExists checks if an image exists
func (*Docker) ImagesPreloaded ¶ added in v1.12.3
func (*Docker) KillContainers ¶
KillContainers forcibly removes a running container based on ID
func (*Docker) KubeletOptions ¶
KubeletOptions returns kubelet options for a runtime.
func (*Docker) ListContainers ¶
func (r *Docker) ListContainers(o ListOptions) ([]string, error)
ListContainers returns a list of containers
func (*Docker) PauseContainers ¶ added in v1.7.0
PauseContainers pauses a running container based on ID
func (*Docker) Preload ¶ added in v1.8.0
func (r *Docker) Preload(cfg config.KubernetesConfig) error
Preload preloads docker with k8s images: 1. Copy over the preloaded tarball into the VM 2. Extract the preloaded tarball to the correct directory 3. Remove the tarball within the VM
func (*Docker) SocketPath ¶
SocketPath returns the path to the socket file for Docker
func (*Docker) StopContainers ¶
StopContainers stops a running container based on ID
func (*Docker) SystemLogCmd ¶ added in v1.3.0
SystemLogCmd returns the command to retrieve system logs
func (*Docker) UnpauseContainers ¶ added in v1.7.0
UnpauseContainers unpauses a container based on ID
type ErrISOFeature ¶ added in v1.8.2
type ErrISOFeature struct {
// contains filtered or unexported fields
}
ErrISOFeature is the error returned when disk image is missing features
func NewErrISOFeature ¶ added in v1.8.2
func NewErrISOFeature(missing string) *ErrISOFeature
NewErrISOFeature creates a new ErrISOFeature
func (*ErrISOFeature) Error ¶ added in v1.8.2
func (e *ErrISOFeature) Error() string
type ListOptions ¶ added in v1.7.0
type ListOptions struct { // State is the container state to filter by (All, Running, Paused) State ContainerState // Name is a name filter Name string // Namespaces is the namespaces to look into Namespaces []string }
ListOptions are the options to use for listing containers
type Manager ¶
type Manager interface { // Name is a human readable name for a runtime Name() string // Version retrieves the current version of this runtime Version() (string, error) // Enable idempotently enables this runtime on a host Enable(bool, bool) 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 // Style is an associated StyleEnum for Name() Style() out.StyleEnum // CGroupDriver returns cgroup driver ("cgroupfs" or "systemd") CGroupDriver() (string, 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 // Load an image idempotently into the runtime on a host LoadImage(string) error // ImageExists takes image name and image sha checks if an it exists ImageExists(string, string) bool // ListContainers returns a list of managed by this container runtime ListContainers(ListOptions) ([]string, error) // KillContainers removes containers based on ID KillContainers([]string) error // StopContainers stops containers based on ID StopContainers([]string) error // PauseContainers pauses containers based on ID PauseContainers([]string) error // UnpauseContainers unpauses containers based on ID UnpauseContainers([]string) error // ContainerLogCmd returns the command to retrieve the log for a container based on ID ContainerLogCmd(string, int, bool) string // SystemLogCmd returns the command to return the system logs SystemLogCmd(int) string // Preload preloads the container runtime with k8s images Preload(config.KubernetesConfig) error // ImagesPreloaded returns true if all images have been preloaded ImagesPreloaded([]string) bool }
Manager is a common interface for container runtimes