Documentation ¶
Index ¶
Constants ¶
View Source
const (
// ContainerRuntimeKey is the settings key for container runtime.
ContainerRuntimeKey = "runtime"
)
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, hidden bool)
RegisterContainer registers a new container runtime. If hidden is true, the container is not displayed as an available runtime.
Types ¶
type Arch ¶ added in v0.3.0
type Arch string
Arch is the CPU architecture of the VM.
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(ctx context.Context) error // Start starts the container runtime. Start(ctx context.Context) error // Stop stops the container runtime. Stop(ctx context.Context) error // Teardown tears down/uninstall the container runtime. Teardown(ctx context.Context) error // Version returns the container runtime version. Version(ctx context.Context) string // Running returns if the container runtime is currently running. Running(ctx context.Context) 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(ctx context.Context, conf config.Config) error // Stop shuts down the VM Stop(ctx context.Context, force bool) error // Restart restarts the VM Restart(ctx context.Context) error // SSH performs an ssh connection to the VM SSH(workingDir string, args ...string) error // Created returns if the VM has been previously created. Created() bool // Running returns if the VM is currently running. Running(ctx context.Context) 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 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(ctx context.Context) error }
VM is virtual machine.
Click to show internal directories.
Click to hide internal directories.