runtime

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ItzoRuntimeName   = "itzo"
	PodmanRuntimeName = "podman"
	AnkaRuntimeName   = "anka"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ContainerService

type ContainerService interface {
	CreateContainer(unit api.Unit, spec *api.PodSpec, podName string, registryCredentials map[string]api.RegistryCredentials, useOverlayfs bool) (*api.UnitStatus, error)
	StartContainer(unit api.Unit, spec *api.PodSpec, podName string) (*api.UnitStatus, error)
	RemoveContainer(unit *api.Unit) error
	ContainerStatus(unitName, unitImage string) (*api.UnitStatus, error)
	//ExecSync()
	//Exec()
	//Attach()
	//PortForward()
	// TODO:: those below are needed for server handlers, we should think about ways to remove them from this interface
	GetLogBuffer(options LogOptions) (*logbuf.LogBuffer, error)
	UnitRunning(unitName string) bool
	GetPid(unitName string) (int, bool)
	SetPodNetwork(netNS, podIP string)
}

type ImagePuller

type ImagePuller struct {
}

func (*ImagePuller) PullImage

func (ip *ImagePuller) PullImage(rootdir, name, image string, registryCredentials map[string]api.RegistryCredentials, useOverlayfs bool) error

type ImageService

type ImageService interface {
	PullImage(rootdir, name, image string, registryCredentials map[string]api.RegistryCredentials, useOverlayfs bool) error
}

type ItzoRuntime

type ItzoRuntime struct {
	metrics.ItzoMetricsProvider

	UnitMgr   UnitRunner
	MountCtl  Mounter
	ImgPuller ImageService
	// contains filtered or unexported fields
}

func NewItzoRuntime

func NewItzoRuntime(rootdir string, unitMgr UnitRunner, mounter Mounter, imgPuller ImageService) *ItzoRuntime

func (*ItzoRuntime) ContainerStatus

func (i *ItzoRuntime) ContainerStatus(unitName, unitImage string) (*api.UnitStatus, error)

func (*ItzoRuntime) CreateContainer

func (i *ItzoRuntime) CreateContainer(unit api.Unit, spec *api.PodSpec, podName string, registryCredentials map[string]api.RegistryCredentials, useOverlayfs bool) (*api.UnitStatus, error)

func (*ItzoRuntime) GetLogBuffer

func (i *ItzoRuntime) GetLogBuffer(options LogOptions) (*logbuf.LogBuffer, error)

func (*ItzoRuntime) GetPid

func (i *ItzoRuntime) GetPid(unitName string) (int, bool)

func (*ItzoRuntime) RemoveContainer

func (i *ItzoRuntime) RemoveContainer(unit *api.Unit) error

func (*ItzoRuntime) RemovePodSandbox

func (i *ItzoRuntime) RemovePodSandbox(spec *api.PodSpec) error

func (*ItzoRuntime) RunPodSandbox

func (i *ItzoRuntime) RunPodSandbox(spec *api.PodSpec) error

func (*ItzoRuntime) SetPodNetwork

func (i *ItzoRuntime) SetPodNetwork(netNS, podIP string)

func (*ItzoRuntime) StartContainer

func (i *ItzoRuntime) StartContainer(unit api.Unit, podSpec *api.PodSpec, podName string) (*api.UnitStatus, error)

func (*ItzoRuntime) StopPodSandbox

func (i *ItzoRuntime) StopPodSandbox(spec *api.PodSpec) error

func (*ItzoRuntime) UnitRunning

func (i *ItzoRuntime) UnitRunning(unitName string) bool

type LogOptions

type LogOptions struct {
	UnitName     string
	Follow       bool
	WithMetadata bool
	LineNum      int
	BytesNum     int
}

This is placed in runtime package, because I'll refactor RuntimeService log functions to use this struct.

func NewLogOptionsFromURL

func NewLogOptionsFromURL(logUrl *url.URL) (*LogOptions, error)

type Mounter

type Mounter interface {
	CreateMount(*api.Volume) error
	DeleteMount(*api.Volume) error
	AttachMount(unitname, src, dst string) error
	DetachMount(unitname, dst string) error
}

type PodSandbox

type PodSandbox interface {
	RunPodSandbox(spec *api.PodSpec) error
	StopPodSandbox(spec *api.PodSpec) error
	RemovePodSandbox(spec *api.PodSpec) error
}

type Puller

type Puller interface {
	PullImage(rootdir, name, image, server, username, password string) error
}

type RuntimeService

type RuntimeService interface {
	PodSandbox
	ContainerService
	metrics.MetricsProvider
}

This is heavily based on Kubernetes CRI. Methods we don't really need are commented out. Having it that similar to CRI opens a door for using it in the future.

type UnitRunner

type UnitRunner interface {
	StartUnit(string, string, string, string, string, []string, []string, []string, api.RestartPolicy) error
	StopUnit(string) error
	RemoveUnit(string) error
	UnitRunning(string) bool
	GetLogBuffer(unitName string) (*logbuf.LogBuffer, error)
	ReadLogBuffer(unitName string, n int) ([]logbuf.LogEntry, error)
	GetPid(string) (int, bool)
}

Too bad there isn't a word for a creator AND destroyer Coulda gone with Shiva(er) but that's a bit imprecise...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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