config

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HostArchitecture = getHostArchitecture()

Functions

This section is empty.

Types

type ArchiveFragment

type ArchiveFragment struct {
	HostFilename string `json:"host_filename" yaml:"host_filename"`
	Target       string `json:"target" yaml:"target"`
}

type BuilderConfig

type BuilderConfig struct {
	HostAddress        string
	Commands           []string
	Environment        []string
	ExecInit           string
	OutputFilename     string
	DefaultInteractive []string
}

type BuiltinFragment

type BuiltinFragment struct {
	Name          string          `json:"builtin" yaml:"builtin"`
	Architecture  CPUArchitecture `json:"architecture" yaml:"architecture"`
	GuestFilename string          `json:"guest_filename" yaml:"guest_filename"`
}

type CPUArchitecture added in v0.1.0

type CPUArchitecture string
const (
	ArchInvalid CPUArchitecture = ""
	ArchX8664   CPUArchitecture = "x86_64"
	ArchARM64   CPUArchitecture = "aarch64"
)

func ArchitectureFromString added in v0.1.0

func ArchitectureFromString(s string) (CPUArchitecture, error)

func (CPUArchitecture) IsNative added in v0.1.0

func (arch CPUArchitecture) IsNative() bool

type DefaultInteractiveFragment added in v0.1.0

type DefaultInteractiveFragment struct {
	Args []string `json:"args"`
}

type EnvironmentFragment added in v0.1.0

type EnvironmentFragment struct {
	Variables []string `json:"variables" yaml:"variables"`
}

type ExportPortFragment added in v0.1.0

type ExportPortFragment struct {
	Name string `json:"name" yaml:"name"`
	Port int    `json:"port" yaml:"port"`
}

type FileContentsFragment

type FileContentsFragment struct {
	Contents      []byte `json:"contents" yaml:"contents"`
	GuestFilename string `json:"guest_filename" yaml:"guest_filename"`
	Executable    bool   `json:"executable" yaml:"executable"`
}

type Fragment

type Fragment struct {
	// Not supported by TinyRange directly.
	RunCommand         *RunCommandFragment         `json:"run_command,omitempty" yaml:"run_command"`
	DefaultInteractive *DefaultInteractiveFragment `json:"interactive,omitempty" yaml:"interactive"`
	Environment        *EnvironmentFragment        `json:"environment,omitempty" yaml:"environment"`
	LocalFile          *LocalFileFragment          `json:"local_file,omitempty" yaml:"local_file"`
	FileContents       *FileContentsFragment       `json:"file_contents,omitempty" yaml:"file_contents"`
	Archive            *ArchiveFragment            `json:"archive,omitempty" yaml:"archive"`
	Builtin            *BuiltinFragment            `json:"builtin,omitempty" yaml:"builtin"`
	ExportPort         *ExportPortFragment         `json:"export_port,omitempty" yaml:"export_port"`
	MountHostDirectory *MountHostDirectoryFragment `json:"mount_host_directory,omitempty" yaml:"mount_host_directory"`
	Kernel             *KernelFragment             `json:"kernel,omitempty" yaml:"kernel"`
}

type KernelFragment added in v0.1.0

type KernelFragment struct {
	KernelFilename    string `json:"kernel_filename" yaml:"kernel_filename"`
	InitramfsFilename string `json:"initramfs_filename" yaml:"initramfs_filename"`
}

type LocalFileFragment

type LocalFileFragment struct {
	HostFilename  string `json:"host_filename" yaml:"host_filename"`
	GuestFilename string `json:"guest_filename" yaml:"guest_filename"`
	Executable    bool   `json:"executable" yaml:"executable"`
}

type MountHostDirectoryFragment added in v0.1.0

type MountHostDirectoryFragment struct {
	HostDirectory string `json:"host_directory" yaml:"host_directory"`
}

type RunCommandFragment

type RunCommandFragment struct {
	Command string `json:"command" yaml:"command"`
}

type TinyRangeConfig

type TinyRangeConfig struct {
	// The base directory all other filenames resolve from.
	BaseDirectory string `json:"base_directory" yaml:"base_directory"`
	// The CPU Architecture of the guest.
	Architecture CPUArchitecture `json:"architecture" yaml:"architecture"`
	// The filename of the hypervisor starlark script to use.
	HypervisorScript string `json:"hypervisor_script" yaml:"hypervisor_script"`
	// The kernel to boot.
	KernelFilename string `json:"kernel_filename" yaml:"kernel_filename"`
	// A initramfs to pass to the kernel or "" to disable passing a initramfs.
	InitFilesystemFilename string `json:"init_filesystem_filename" yaml:"init_filesystem_filename"`
	// A list of RootFsFragments.
	RootFsFragments []Fragment `json:"rootfs_fragments" yaml:"rootfs_fragments"`
	// The size of the rootfs in megabytes.
	StorageSize int `json:"storage_size" yaml:"storage_size"`
	// The way the user will interact with the virtual machine (options: [ssh, serial], default: ssh).
	Interaction string `json:"interaction" yaml:"interaction"`
	// The number of CPU cores to allocate to the virtual machine.
	CPUCores int `json:"cpu_cores" yaml:"cpu_cores"`
	// The amount of memory to allocate to the virtual machine.
	MemoryMB int `json:"memory_mb" yaml:"memory_mb"`
	// Config parameters to pass to the hypervisor.
	HypervisorConfig map[string]string `json:"hypervisor_config" yaml:"hypervisor_config"`
	// Redirect hypervisor input to the host. The VM will exit after it completes initialization.
	Debug bool `json:"debug" yaml:"debug"`
}

A config file that can be passed to TinyRange to configure and execute a virtual machine.

func (TinyRangeConfig) Resolve

func (cfg TinyRangeConfig) Resolve(filename string) string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳