config

package
v0.66.1 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package config handles loading, parsing, and validating the multi-node cluster configuration from YAML files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CiliumConfig added in v0.66.0

type CiliumConfig struct {
	Enabled bool   `yaml:"enabled"`
	Version string `yaml:"version,omitempty"` // informational; helm pin lives in GitOps
}

CiliumConfig selects the Cilium CNI (Flannel+kube-proxy+servicelb disabled in k3s).

type ClusterConfig

type ClusterConfig struct {
	Name       string          `yaml:"name"`
	K3sVersion string          `yaml:"k3sVersion"`
	Kubeconfig string          `yaml:"kubeconfig"`
	MetalLB    MetalLBConfig   `yaml:"metallb"`
	Cilium     CiliumConfig    `yaml:"cilium"`
	Tailscale  TailscaleConfig `yaml:"tailscale"`
	Docker     DockerConfig    `yaml:"docker"`
	Mounts     []MountConfig   `yaml:"mounts"`
	USB        USBConfig       `yaml:"usb"`
}

ClusterConfig holds cluster-wide settings.

type Config

type Config struct {
	Cluster ClusterConfig `yaml:"cluster"`
	Nodes   []NodeConfig  `yaml:"nodes"`
}

Config is the top-level configuration for a multi-node cluster.

func Load

func Load(path string) (*Config, error)

Load reads and parses a config file from the given path. It will search parent directories for the file if only a filename is provided.

func (*Config) AgentNodes

func (c *Config) AgentNodes() []NodeConfig

AgentNodes returns only the nodes with role "agent".

func (*Config) InitNode

func (c *Config) InitNode() NodeConfig

InitNode returns the first server node, which is used to bootstrap the cluster.

func (*Config) ServerNodes

func (c *Config) ServerNodes() []NodeConfig

ServerNodes returns only the nodes with role "server".

func (*Config) Validate

func (c *Config) Validate() error

Validate checks that the config is well-formed and internally consistent.

type DockerConfig added in v0.47.0

type DockerConfig struct {
	Enabled bool `yaml:"enabled"`
	// DockerVersion and ContainerdVersion pin the node container runtime to an
	// exact, mutually-compatible apt version pair (held via apt-mark) so a node
	// restart or unattended upgrade can never pair a mismatched
	// containerd<->shim — the cause of the "unsupported protocol" pod-sandbox
	// creation failures. Empty falls back to lima.DefaultDockerVersion /
	// lima.DefaultContainerdVersion (the pin tracked in git, since cluster.yaml
	// is local). Bump the two together.
	DockerVersion     string `yaml:"dockerVersion,omitempty"`
	ContainerdVersion string `yaml:"containerdVersion,omitempty"`
}

DockerConfig holds configuration for Docker runtime integration.

type MetalLBConfig added in v0.43.1

type MetalLBConfig struct {
	Enabled bool   `yaml:"enabled"`
	IPRange string `yaml:"ipRange"`
	// L2Hostnames pins the L2Advertisement to a stable subset of nodes via a
	// per-hostname nodeSelector (kubernetes.io/hostname). Empty = advertise from
	// all nodes (default MetalLB behaviour). Pinning stops the speaker VIP from
	// flapping onto high-latency Mac nodes.
	L2Hostnames []string `yaml:"l2Hostnames"`
}

MetalLBConfig holds configuration for the MetalLB load balancer.

type MountConfig added in v0.57.0

type MountConfig struct {
	Location   string `yaml:"location"`             // host path; "~" is allowed and expanded on the target host
	MountPoint string `yaml:"mountPoint,omitempty"` // guest path; defaults to the same path as Location
	Writable   bool   `yaml:"writable,omitempty"`   // default false; the injected home-default sets this true
}

MountConfig describes a host directory shared into the cluster VMs so that containers launched by the in-VM Docker daemon (e.g. devcontainers) can see host source files at the same path.

Default-vs-opt-out is decided by presence: an omitted `mounts:` key (nil slice) defaults to the host home dir; an explicit `mounts: []` opts out. See lima.ResolveMounts.

type NodeConfig

type NodeConfig struct {
	Host       string   `yaml:"host"`
	Role       string   `yaml:"role"`             // "server" or "agent"
	Pool       string   `yaml:"pool"`             //
	Kind       string   `yaml:"kind,omitempty"`   // "lima" (default, macOS+VM) | "native" (Linux host, no VM)
	NodeIP     string   `yaml:"nodeIP,omitempty"` // native: override the auto-detected tailscale IP
	VM         VMConfig `yaml:"vm"`               // required for kind=lima; ignored for kind=native
	VMName     string   `yaml:"vmName,omitempty"`
	SSHUser    string   `yaml:"sshUser,omitempty"`
	SSHPort    string   `yaml:"sshPort,omitempty"`
	SSHKeyPath string   `yaml:"sshKeyPath,omitempty"`
}

NodeConfig describes a single node in the cluster.

func (*NodeConfig) GetKind added in v0.62.0

func (n *NodeConfig) GetKind() string

GetKind returns the node kind, defaulting to "lima".

func (*NodeConfig) GetVMName

func (n *NodeConfig) GetVMName() string

GetVMName returns the VM name for this node, defaulting to "k8s-node".

type TailscaleConfig added in v0.43.1

type TailscaleConfig struct {
	Enabled bool   `yaml:"enabled"`
	AuthKey string `yaml:"authKey"`
}

TailscaleConfig holds configuration for Tailscale networking.

type USBConfig added in v0.60.0

type USBConfig struct {
	Renderers        []string   `yaml:"renderers,omitempty"`        // subset of fcos|baked; empty = all
	NodeNamePrefix   string     `yaml:"nodeNamePrefix,omitempty"`   // default "usb"
	Pool             string     `yaml:"pool,omitempty"`             // node pool label; default "usb"
	AgentToken       string     `yaml:"agentToken,omitempty"`       // dedicated least-privilege k3s agent token
	TailnetServerURL string     `yaml:"tailnetServerURL,omitempty"` // explicit tailnet API URL override
	Scratch          string     `yaml:"scratch,omitempty"`          // none|existing:<src>|free-space
	NodeTTL          string     `yaml:"nodeTTL,omitempty"`          // e.g. "30m"; prune NotReady ephemeral nodes older than this
	WiFi             WiFiConfig `yaml:"wifi,omitempty"`             // optional Wi-Fi creds baked into the boot config
}

USBConfig holds defaults for `devx cluster usb`, which builds a GPT Fedora CoreOS image (via coreos-installer) that boots a bare-metal laptop into a self-joining node. All fields are optional; command-line flags override them.

type VMConfig

type VMConfig struct {
	CPUs   int    `yaml:"cpus"`
	Memory string `yaml:"memory"`
	Disk   string `yaml:"disk"`
}

VMConfig describes the resource allocation for a Lima VM.

type WiFiConfig added in v0.60.0

type WiFiConfig struct {
	SSID string `yaml:"ssid,omitempty"`
	PSK  string `yaml:"psk,omitempty"`
}

WiFiConfig carries optional Wi-Fi credentials baked into the join script, so a laptop with no Ethernet can still reach the cluster.

Jump to

Keyboard shortcuts

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