configmanager

package
v5.9.0 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

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, KSail), with support for environment variable overrides and field validation.

Key functionality:

  • ConfigManager interface for generic configuration loading
  • Distribution-specific config managers (Kind, K3d, KSail)
  • Common helpers for loading, validation, and error formatting
  • Support for default values when configuration files are missing

Subpackages:

  • helpers: Common functionality shared across config managers
  • k3d: K3d-specific configuration management
  • kind: Kind-specific configuration management
  • ksail: KSail-specific configuration management

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetClusterName

func GetClusterName(config any) (string, error)

GetClusterName extracts the cluster name from supported Kind, K3d, or Talos config structures. For Talos and TalosInDocker configs, use types implementing ClusterNameProvider.

Types

type ClusterNameProvider added in v5.9.0

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 TalosInDockerConfig.

type ConfigManager

type ConfigManager[T any] interface {
	// LoadConfig loads the configuration from files and environment variables.
	// Returns the loaded config, either freshly loaded or previously cached.
	// If timer is provided, timing information will be included in the success notification.
	LoadConfig(tmr timer.Timer) (*T, error)
}

ConfigManager provides configuration management functionality.

type MockConfigManager

type MockConfigManager[T any] struct {
	mock.Mock
}

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]) LoadConfig

func (_mock *MockConfigManager[T]) LoadConfig(tmr timer.Timer) (*T, error)

LoadConfig 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]) LoadConfig

func (_e *MockConfigManager_Expecter[T]) LoadConfig(tmr interface{}) *MockConfigManager_LoadConfig_Call[T]

LoadConfig is a helper method to define mock.On call

  • tmr timer.Timer

type MockConfigManager_LoadConfig_Call

type MockConfigManager_LoadConfig_Call[T any] struct {
	*mock.Call
}

MockConfigManager_LoadConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LoadConfig'

func (*MockConfigManager_LoadConfig_Call[T]) Return

func (*MockConfigManager_LoadConfig_Call[T]) Run

func (*MockConfigManager_LoadConfig_Call[T]) RunAndReturn

func (_c *MockConfigManager_LoadConfig_Call[T]) RunAndReturn(run func(tmr timer.Timer) (*T, error)) *MockConfigManager_LoadConfig_Call[T]

Directories

Path Synopsis
Package helpers provides common functionality for config managers to eliminate duplication.
Package helpers provides common functionality for config managers to eliminate duplication.
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 talos provides configuration management for Talos cluster patches.
Package talos provides configuration management for Talos cluster patches.

Jump to

Keyboard shortcuts

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