Documentation
¶
Overview ¶
Package configmanager provides centralized configuration management for KSail.
This package contains interfaces and implementations for loading and managing configuration files across different distribution types (Kind, K3d, Talos, KSail), with support for environment variable overrides and field validation.
Key functionality:
- ConfigManager interface for generic configuration loading
- Common helpers for loading, validation, and error formatting
- Support for default values when configuration files are missing
Subpackages:
- k3d: K3d-specific configuration management
- kind: Kind-specific configuration management
- ksail: KSail-specific configuration management (import as ksailconfigmanager)
- loader: Configuration file loading utilities
- talos: Talos-specific configuration management
Index ¶
- func GetClusterName(config any) (string, error)
- type ClusterNameProvider
- type ConfigManager
- type LoadOptions
- type MockConfigManager
- type MockConfigManager_Expecter
- type MockConfigManager_Load_Call
- func (_c *MockConfigManager_Load_Call[T]) Return(v *T, err error) *MockConfigManager_Load_Call[T]
- func (_c *MockConfigManager_Load_Call[T]) Run(run func(opts LoadOptions)) *MockConfigManager_Load_Call[T]
- func (_c *MockConfigManager_Load_Call[T]) RunAndReturn(run func(opts LoadOptions) (*T, error)) *MockConfigManager_Load_Call[T]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetClusterName ¶
GetClusterName extracts the cluster name from supported Kind, K3d, or Talos config structures. For Talos and Talos configs, use types implementing ClusterNameProvider.
Types ¶
type ClusterNameProvider ¶
type ClusterNameProvider interface {
GetClusterName() string
}
ClusterNameProvider is an interface for types that can provide a cluster name. This allows GetClusterName to work with any config type that implements this method, including talos.Configs and TalosConfig.
type ConfigManager ¶
type ConfigManager[T any] interface { // Load loads the configuration with the specified options. // Returns the loaded config, either freshly loaded or previously cached. Load(opts LoadOptions) (*T, error) }
ConfigManager provides configuration management functionality.
type LoadOptions ¶
type LoadOptions struct {
// Timer enables timing output in notifications when provided.
Timer timer.Timer
// Silent suppresses all loading notifications when true.
Silent bool
// IgnoreConfigFile skips reading on-disk config files when true (flags/defaults only).
IgnoreConfigFile bool
// SkipValidation skips config validation when true.
// Useful for commands that only need partial config (e.g., context/kubeconfig).
SkipValidation bool
}
LoadOptions configures how configuration is loaded.
type MockConfigManager ¶
MockConfigManager is an autogenerated mock type for the ConfigManager type
func NewMockConfigManager ¶
func NewMockConfigManager[T any](t interface { mock.TestingT Cleanup(func()) }) *MockConfigManager[T]
NewMockConfigManager creates a new instance of MockConfigManager. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockConfigManager[T]) EXPECT ¶
func (_m *MockConfigManager[T]) EXPECT() *MockConfigManager_Expecter[T]
func (*MockConfigManager[T]) Load ¶
func (_mock *MockConfigManager[T]) Load(opts LoadOptions) (*T, error)
Load provides a mock function for the type MockConfigManager
type MockConfigManager_Expecter ¶
type MockConfigManager_Expecter[T any] struct { // contains filtered or unexported fields }
func (*MockConfigManager_Expecter[T]) Load ¶
func (_e *MockConfigManager_Expecter[T]) Load(opts interface{}) *MockConfigManager_Load_Call[T]
Load is a helper method to define mock.On call
- opts LoadOptions
type MockConfigManager_Load_Call ¶
MockConfigManager_Load_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Load'
func (*MockConfigManager_Load_Call[T]) Return ¶
func (_c *MockConfigManager_Load_Call[T]) Return(v *T, err error) *MockConfigManager_Load_Call[T]
func (*MockConfigManager_Load_Call[T]) Run ¶
func (_c *MockConfigManager_Load_Call[T]) Run(run func(opts LoadOptions)) *MockConfigManager_Load_Call[T]
func (*MockConfigManager_Load_Call[T]) RunAndReturn ¶
func (_c *MockConfigManager_Load_Call[T]) RunAndReturn(run func(opts LoadOptions) (*T, error)) *MockConfigManager_Load_Call[T]
Directories
¶
| Path | Synopsis |
|---|---|
|
Package k3d provides configuration management for K3d clusters.
|
Package k3d provides configuration management for K3d clusters. |
|
Package kind provides configuration management for Kind clusters.
|
Package kind provides configuration management for Kind clusters. |
|
Package configmanager provides configuration management for KSail v1alpha1.Cluster configurations.
|
Package configmanager provides configuration management for KSail v1alpha1.Cluster configurations. |
|
Package loader provides common functionality for config managers to eliminate duplication.
|
Package loader provides common functionality for config managers to eliminate duplication. |
|
Package talos provides configuration management for Talos cluster patches.
|
Package talos provides configuration management for Talos cluster patches. |
|
Package vcluster provides default configuration for vCluster clusters.
|
Package vcluster provides default configuration for vCluster clusters. |