environment

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2022 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// ContainerRuntimeKey is the settings key for container runtime.
	ContainerRuntimeKey = "runtime"
	// KubernetesVersionKey is the settings key for kubernetes version.
	KubernetesVersionKey = "kubernetes_version"

	// BinfmtTarFile is the path in the VM to the binfmt oci image tar.
	// TODO: decide if this should reside somewhere else.
	BinfmtTarFile = "/usr/local/colima/binfmt.tar"
)

VM configurations

Variables

This section is empty.

Functions

func ContainerRuntimes

func ContainerRuntimes() (names []string)

ContainerRuntimes return the names of available container runtimes.

func RegisterContainer

func RegisterContainer(name string, f NewContainerFunc)

RegisterContainer registers a new container runtime.

Types

type Arch added in v0.3.0

type Arch string

Arch is the VM architecture.

const (
	X8664   Arch = "x86_64"
	AARCH64 Arch = "aarch64"
)

func (Arch) GoArch added in v0.3.0

func (a Arch) GoArch() string

GoArch returns the GOARCH equivalent value for the architecture.

func (Arch) Value added in v0.3.0

func (a Arch) Value() Arch

Value converts the underlying architecture alias value to one of X8664 or AARCH64.

type Container

type Container interface {
	// Name is the name of the container runtime. e.g. docker, containerd
	Name() string
	// Provision provisions/installs the container runtime.
	// Should be idempotent.
	Provision() error
	// Start starts the container runtime.
	Start() error
	// Stop stops the container runtime.
	Stop() error
	// Teardown tears down/uninstall the container runtime.
	Teardown() error
	// Version returns the container runtime version.
	Version() string
	// Running returns if the container runtime is currently running.
	Running() bool

	Dependencies
}

Container is container environment.

func NewContainer

func NewContainer(runtime string, host HostActions, guest GuestActions) (Container, error)

NewContainer creates a new container environment.

type Dependencies

type Dependencies interface {
	// Dependencies are dependencies that must exist on the host.
	// TODO this may need to accommodate non-brew installable dependencies
	Dependencies() []string
}

Dependencies are dependencies that must exist on the host.

type GuestActions

type GuestActions interface {

	// Start starts up the VM
	Start(config.Config) error
	// Stop shuts down the VM
	Stop() error
	// Restart restarts the VM
	Restart() error
	// Created returns if the VM has been previously created.
	Created() bool
	// Running returns if the VM is currently running.
	Running() bool
	// Env retrieves environment variable in the VM.
	Env(string) (string, error)
	// Get retrieves a configuration in the VM.
	Get(key string) string
	// Set sets configuration in the VM.
	Set(key, value string) error
	// User returns the username of the user in the VM.
	User() (string, error)
	// Arch returns the architecture of the VM.
	Arch() Arch
	// contains filtered or unexported methods
}

GuestActions are actions performed on the guest i.e. VM.

type Host

type Host interface {
	HostActions
}

Host is the host environment.

type HostActions

type HostActions interface {

	// WithEnv creates a new instance based on the current instance
	// with the specified environment variables.
	WithEnv(env ...string) HostActions
	// Env retrieves environment variable on the host.
	Env(string) string
	// contains filtered or unexported methods
}

HostActions are actions performed on the host.

type NewContainerFunc

type NewContainerFunc func(host HostActions, guest GuestActions) Container

NewContainerFunc is implemented by container runtime implementations to create a new instance.

type VM

type VM interface {
	GuestActions
	Dependencies
	Host() HostActions
	Teardown() error
}

VM is virtual machine.

Directories

Path Synopsis
container
vm

Jump to

Keyboard shortcuts

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