Documentation
¶
Overview ¶
Package config handles loading, parsing, and validating the homelab cluster configuration from YAML files.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClusterConfig ¶
type ClusterConfig struct {
Name string `yaml:"name"`
K3sVersion string `yaml:"k3sVersion"`
Kubeconfig string `yaml:"kubeconfig"`
}
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 homelab 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 NodeConfig ¶
type NodeConfig struct {
Host string `yaml:"host"`
Role string `yaml:"role"` // "server" or "agent"
Pool string `yaml:"pool"`
VM VMConfig `yaml:"vm"`
VMName string `yaml:"vmName,omitempty"` // Override default VM name (default: "k8s-node")
SSHUser string `yaml:"sshUser,omitempty"` // SSH username (default: current user)
SSHPort string `yaml:"sshPort,omitempty"` // SSH port (default: 22)
SSHKeyPath string `yaml:"sshKeyPath,omitempty"` // Path to SSH private key (optional)
}
NodeConfig describes a single node in the cluster.
func (*NodeConfig) GetVMName ¶
func (n *NodeConfig) GetVMName() string
GetVMName returns the VM name for this node, defaulting to "k8s-node".