config

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2025 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const (
	AppName = "colima"
)

Variables

This section is empty.

Functions

func CacheDir

func CacheDir() string

CacheDir returns the cache directory.

func CtxKey added in v0.4.0

func CtxKey() any

CtxKey returns the context key for config.

func EnvProfile added in v0.8.2

func EnvProfile() string

func LimaDir added in v0.6.0

func LimaDir() string

LimaDir returns Lima directory.

func SSHConfigFile added in v0.5.6

func SSHConfigFile() string

SSHConfigFile returns the path to generated ssh config.

func SetProfile

func SetProfile(profileName string)

SetProfile sets the profile name for the application. This is an avenue to test Colima without breaking an existing stable setup. Not perfect, but good enough for testing.

func TemplatesDir added in v0.4.0

func TemplatesDir() string

TemplatesDir returns the templates' directory.

Types

type Config

type Config struct {
	CPU      int               `yaml:"cpu,omitempty"`
	Disk     int               `yaml:"disk,omitempty"`
	RootDisk int               `yaml:"rootDisk,omitempty"`
	Memory   float32           `yaml:"memory,omitempty"`
	Arch     string            `yaml:"arch,omitempty"`
	CPUType  string            `yaml:"cpuType,omitempty"`
	Network  Network           `yaml:"network,omitempty"`
	Env      map[string]string `yaml:"env,omitempty"` // environment variables
	Hostname string            `yaml:"hostname"`

	// SSH
	SSHPort      int  `yaml:"sshPort,omitempty"`
	ForwardAgent bool `yaml:"forwardAgent,omitempty"`
	SSHConfig    bool `yaml:"sshConfig,omitempty"` // config generation

	// VM
	VMType               string `yaml:"vmType,omitempty"`
	VZRosetta            bool   `yaml:"rosetta,omitempty"`
	Binfmt               *bool  `yaml:"binfmt,omitempty"`
	NestedVirtualization bool   `yaml:"nestedVirtualization,omitempty"`
	DiskImage            string `yaml:"diskImage,omitempty"`
	PortForwarder        string `yaml:"portForwarder,omitempty"` // "ssh", "grpc"

	// volume mounts
	Mounts       []Mount `yaml:"mounts,omitempty"`
	MountType    string  `yaml:"mountType,omitempty"`
	MountINotify bool    `yaml:"mountInotify,omitempty"`

	// Runtime is one of docker, containerd.
	Runtime         string `yaml:"runtime,omitempty"`
	ActivateRuntime *bool  `yaml:"autoActivate,omitempty"`

	// Kubernetes configuration
	Kubernetes Kubernetes `yaml:"kubernetes,omitempty"`

	// Docker configuration
	Docker map[string]any `yaml:"docker,omitempty"`

	// provision scripts
	Provision []Provision `yaml:"provision,omitempty"`
}

Config is the application config.

func (Config) AutoActivate added in v0.4.5

func (c Config) AutoActivate() bool

AutoActivate returns if auto-activation of host client config is enabled.

func (Config) DriverLabel added in v0.5.0

func (c Config) DriverLabel() string

func (Config) Empty

func (c Config) Empty() bool

Empty checks if the configuration is empty.

func (Config) MountsOrDefault added in v0.4.3

func (c Config) MountsOrDefault() []Mount

type Disk added in v0.9.0

type Disk int

Disk is an instance disk size

func (Disk) GiB added in v0.9.0

func (d Disk) GiB() string

GiB returns the string represent of the disk in GiB.

func (Disk) Int added in v0.9.0

func (d Disk) Int() int64

Int returns the disk size in bytes.

type Kubernetes

type Kubernetes struct {
	Enabled bool     `yaml:"enabled"`
	Version string   `yaml:"version"`
	K3sArgs []string `yaml:"k3sArgs"`
	Port    int      `yaml:"port,omitempty"`
}

Kubernetes is kubernetes configuration

type Mount added in v0.4.0

type Mount struct {
	Location   string `yaml:"location"`
	MountPoint string `yaml:"mountPoint,omitempty"`
	Writable   bool   `yaml:"writable"`
}

Mount is volume mount

type Network added in v0.4.0

type Network struct {
	Address         bool              `yaml:"address"`
	DNSResolvers    []net.IP          `yaml:"dns"`
	DNSHosts        map[string]string `yaml:"dnsHosts"`
	HostAddresses   bool              `yaml:"hostAddresses"`
	Mode            string            `yaml:"mode"` // shared, bridged
	BridgeInterface string            `yaml:"interface"`
	PreferredRoute  bool              `yaml:"preferredRoute"`
}

Network is VM network configuration

type Profile

type Profile struct {
	ID          string
	DisplayName string
	ShortName   string

	Changed bool // indicates if the profile has been changed
	// contains filtered or unexported fields
}

Profile is colima profile.

func CurrentProfile added in v0.4.2

func CurrentProfile() *Profile

CurrentProfile returns the current running profile.

func ProfileFromName added in v0.7.0

func ProfileFromName(name string) *Profile

ProfileFromName retrieves profile given name.

func (*Profile) ConfigDir added in v0.7.0

func (p *Profile) ConfigDir() string

ConfigDir returns the configuration directory.

func (*Profile) File added in v0.7.0

func (p *Profile) File() string

File returns the path to the config file.

func (*Profile) LimaFile added in v0.7.0

func (p *Profile) LimaFile() string

LimaFile returns the path to the lima config file.

func (*Profile) LimaInstanceDir added in v0.7.0

func (p *Profile) LimaInstanceDir() string

LimaInstanceDir returns the directory for the Lima instance.

func (*Profile) StateFile added in v0.7.0

func (p *Profile) StateFile() string

StateFile returns the path to the state file.

func (*Profile) StoreFile added in v0.9.0

func (p *Profile) StoreFile() string

type ProfileInfo added in v0.3.0

type ProfileInfo interface {
	// ConfigDir returns the configuration directory.
	ConfigDir() string

	// LimaInstanceDir returns the directory for the Lima instance.
	LimaInstanceDir() string

	// File returns the path to the config file.
	File() string

	// LimaFile returns the path to the lima config file.
	LimaFile() string

	// StateFile returns the path to the state file.
	StateFile() string

	// StoreFile returns the path to the store file.
	StoreFile() string
}

ProfileInfo is the information about a profile.

type Provision added in v0.4.5

type Provision struct {
	Mode   string `yaml:"mode"`
	Script string `yaml:"script"`
}

type VersionInfo

type VersionInfo struct {
	Version  string
	Revision string
}

VersionInfo is the application version info.

func AppVersion

func AppVersion() VersionInfo

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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