config

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package config handles parsing and applying options from finch's config file. These options can be applied to any aspect of the project, from the VMM to components running inside the VM.

Currently, VMM options are applied to one of Lima's configuration files and options within the VM are applied via running SSH commands and writing files via SFTP.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SupportsVirtualizationFramework added in v0.5.0

func SupportsVirtualizationFramework(cmdCreator command.Creator) (bool, error)

SupportsVirtualizationFramework checks if the user's system supports Virtualization.framework.

Types

type AdditionalDirectory added in v0.2.0

type AdditionalDirectory struct {
	Path *string `yaml:"path"`
}

AdditionalDirectory represents the additional directory used in Finch config.

type Finch

type Finch struct {
	CPUs   *int    `yaml:"cpus"`
	Memory *string `yaml:"memory"`
	// AdditionalDirectories are the work directories that are not supported by default. In macOS, only home directory is supported by default.
	// For example, if you want to mount a directory into a container, and that directory is not under your home directory,
	// then you'll need to specify this field to add that directory or any ascendant of it as a work directory.
	AdditionalDirectories []AdditionalDirectory `yaml:"additional_directories,omitempty"`
	// VMType sets which technology to use for Finch's VM.
	// Currently supports `qemu` and `vz` (Virtualization.framework).
	// Also sets mountType to "virtiofs", instead of the default "reverse-sshfs"
	// Requires macOS 13.0 or later.
	// This setting will only be applied on vm init.
	VMType *limayaml.VMType `yaml:"vmType,omitempty"`
	// Use Rosetta 2 when available. Forces vmType to "vz" (Virtualization.framework) if set to `true`.
	// Requires macOS 13.0 or later and an Apple Silicon (ARM64) mac.
	// Has no effect on systems where Rosetta 2 is not available (Intel/AMD64 macs, or macOS < 13.0).
	// This setting will only be applied on vm init.
	Rosetta *bool `yaml:"rosetta,omitempty"`
}

Finch represents the configuration file for Finch CLI.

func Load

func Load(fs afero.Fs, cfgPath string, log flog.Logger, systemDeps LoadSystemDeps, mem fmemory.Memory) (*Finch, error)

Load loads Finch's configuration from a YAML file and initializes default values.

type LimaConfigApplier

type LimaConfigApplier interface {
	Apply(isInit bool) error
}

LimaConfigApplier applies lima configuration changes.

func NewLimaApplier

func NewLimaApplier(
	cfg *Finch,
	cmdCreator command.Creator,
	fs afero.Fs,
	limaConfigPath string,
	systemDeps LimaConfigApplierSystemDeps,
) LimaConfigApplier

NewLimaApplier creates a new LimaConfigApplier that applies lima configuration changes by writing to the lima config file on the disk.

type LimaConfigApplierSystemDeps added in v0.5.0

type LimaConfigApplierSystemDeps interface {
	system.RuntimeArchGetter
	system.RuntimeOSGetter
}

LimaConfigApplierSystemDeps contains the system dependencies for LimaConfigApplier.

type LoadSystemDeps

type LoadSystemDeps interface {
	system.RuntimeCPUGetter
}

LoadSystemDeps contains the system dependencies for Load.

type Nerdctl

type Nerdctl struct {
	Debug            bool     `toml:"debug,omitempty"`
	DebugFull        bool     `toml:"debug_full1,omitempty"`
	Address          string   `toml:"address,omitempty"`
	Namespace        string   `toml:"namespace,omitempty"`
	Snapshotter      string   `toml:"snapshotter,omitempty"`
	CNIPath          string   `toml:"cni_path,omitempty"`
	CNINetConfPath   string   `toml:"cni_netconfpath,omitempty"`
	DataRoot         string   `toml:"data_root,omitempty"`
	CgroupManager    string   `toml:"cgroup_manager,omitempty"`
	InsecureRegistry bool     `toml:"insecure_registry,omitempty"`
	HostsDir         []string `toml:"hosts_dir,omitempty"`
}

Nerdctl is a copy from github.com/containerd/nerdctl/cmd/nerdctl/main.go TODO: make PR to nerdctl repo to move this config out of the main package so it can be imported on macOS.

type NerdctlConfigApplier

type NerdctlConfigApplier interface {
	Apply(remoteAddr string) error
}

NerdctlConfigApplier applies nerdctl configuration changes.

func NewNerdctlApplier

func NewNerdctlApplier(dialer fssh.Dialer, fs afero.Fs, privateKeyPath, hostUser string) NerdctlConfigApplier

NewNerdctlApplier creates a new NerdctlConfigApplier that applies nerdctl configuration changes by SSHing to the lima VM to update the nerdctl configuration file in it.

Jump to

Keyboard shortcuts

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