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"`
LoadBalancer LoadBalancerConfig `yaml:"loadBalancer"`
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.
func (ClusterConfig) LBIPRange ¶ added in v0.66.2
func (c ClusterConfig) LBIPRange() string
LBIPRange returns the LoadBalancer VIP range, preferring the backend-neutral cluster.loadBalancer.ipRange and falling back to the legacy metallb.ipRange.
func (ClusterConfig) LBL2Hostnames ¶ added in v0.66.2
func (c ClusterConfig) LBL2Hostnames() []string
LBL2Hostnames returns the stable L2-advertising nodes, preferring the backend-neutral cluster.loadBalancer.l2Hostnames and falling back to the legacy metallb.l2Hostnames.
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 ¶
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".
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 LoadBalancerConfig ¶ added in v0.66.2
type LoadBalancerConfig struct {
// IPRange is the LoadBalancer VIP range (any MetalLB-style form: CIDR, dashed
// range, bare-suffix range, or single IP). Used both to configure the chosen
// LB backend and to derive the /24 tailnet subnet route for the VIPs.
IPRange string `yaml:"ipRange"`
// L2Hostnames are the stable nodes that advertise the LB range over the
// tailnet (and, for MetalLB, pin the L2Advertisement). Empty = no pinning.
L2Hostnames []string `yaml:"l2Hostnames"`
}
LoadBalancerConfig holds backend-neutral LoadBalancer settings shared by BOTH the MetalLB path and Cilium LB-IPAM: the VIP range and the stable nodes that advertise it over the tailnet (L2). It supersedes the metallb-specific ipRange/l2Hostnames, so a Cilium-LB-IPAM cluster no longer needs a metallb block just to get its VIPs tailnet-reachable. The legacy metallb fields are still honoured as a fallback (see LBIPRange / LBL2Hostnames).
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.
//
// Legacy: prefer the backend-neutral cluster.loadBalancer.{ipRange,l2Hostnames}.
// IPRange and L2Hostnames here remain a supported fallback (see
// ClusterConfig.LBIPRange / LBL2Hostnames) so existing configs keep working.
// (Not marked `Deprecated:` on purpose — the resolvers and their tests still
// read these fields intentionally.)
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
DataDir string `yaml:"dataDir,omitempty"` // native: relocate k3s data-dir + kubelet root-dir onto this path (e.g. a large /home when / is small); empty = k3s default /var/lib/rancher/k3s
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
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
WiFiConfig carries optional Wi-Fi credentials baked into the join script, so a laptop with no Ethernet can still reach the cluster.