environment

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2021 License: MIT Imports: 4 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"
	// SSHPortKey is the settings for the VM SSH port.
	SSHPortKey = "ssh_port"
)

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 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)
	// 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