Documentation
¶
Overview ¶
Package k3d provides configuration management for K3d clusters.
This package contains the core Manager implementation for loading K3d cluster configurations from files, with support for environment variable overrides and Viper-based configuration management.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewK3dSimpleConfig ¶
func NewK3dSimpleConfig(name, apiVersion, kind string) *v1alpha5.SimpleConfig
NewK3dSimpleConfig creates a new v1alpha5.SimpleConfig with the specified name and TypeMeta. This function provides a canonical way to create K3d clusters with proper field initialization. Use empty string for name to create a cluster without a specific name.
func ParseRegistryConfig ¶
ParseRegistryConfig parses K3d registry mirror configuration from raw YAML string. Returns a map of host to endpoints, filtering out empty entries. Intentionally returns an empty map (instead of an error) for invalid YAML to support graceful degradation when registry configuration is malformed or missing.
func ResolveClusterName ¶
func ResolveClusterName( clusterCfg *v1alpha1.Cluster, k3dConfig *v1alpha5.SimpleConfig, ) string
ResolveClusterName returns the effective cluster name from K3d config or cluster config. Priority: k3dConfig.Name > clusterCfg.Spec.Cluster.Connection.Context > "k3d" (default). Returns "k3d" if both configs are nil or have empty names.
Types ¶
type ConfigManager ¶
type ConfigManager struct {
// contains filtered or unexported fields
}
ConfigManager implements configuration management for K3d v1alpha5.SimpleConfig configurations. It provides file-based configuration loading without Viper dependency.
func NewConfigManager ¶
func NewConfigManager(configPath string) *ConfigManager
NewConfigManager creates a new configuration manager for K3d cluster configurations. configPath specifies the path to the K3d configuration file to load.
func (*ConfigManager) LoadConfig ¶
func (m *ConfigManager) LoadConfig(_ timer.Timer) (*v1alpha5.SimpleConfig, error)
LoadConfig loads the K3d configuration from the specified file. Returns the loaded config, either freshly loaded or previously cached. If the file doesn't exist, returns a default K3d cluster configuration. Validates the configuration after loading and returns an error if validation fails. The timer parameter is accepted for interface compliance but not currently used.