defaults

package
v1.0.0-rc07 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExportEffectiveConfig

func ExportEffectiveConfig(cfg interface{}, appliedDefaults map[string]DefaultSource) (string, error)

ExportEffectiveConfig exports the configuration with applied defaults as comments. This allows users to see which values came from defaults vs explicit configuration.

func FormatAppliedDefaults

func FormatAppliedDefaults(appliedDefaults map[string]DefaultSource) string

FormatAppliedDefaults returns a formatted string of applied defaults for display.

Types

type DefaultSource

type DefaultSource string

DefaultSource indicates where a default value came from.

const (
	SourceExplicit       DefaultSource = "explicit"        // User-provided value
	SourceCLIConfig      DefaultSource = "cli_config"      // CLI configuration file
	SourceProviderRegion DefaultSource = "provider_region" // Provider-region registry
	SourceProvider       DefaultSource = "provider"        // Provider-level default
	SourceGlobal         DefaultSource = "global"          // Global default
)

type FlavorDefaults

type FlavorDefaults struct {
	Bastion       string
	Master        string
	Worker        string
	WorkerWindows string
}

FlavorDefaults holds default instance type/flavor names for different node types.

type Hydrator

type Hydrator interface {
	// Hydrate applies defaults to the configuration
	Hydrate(cfg interface{}, provider, region string) error

	// GetAppliedDefaults returns a map of field paths to their default sources
	GetAppliedDefaults() map[string]DefaultSource
}

Hydrator applies default values to configuration without overwriting explicit values.

func NewHydrator

func NewHydrator(registry Registry) Hydrator

NewHydrator creates a new hydrator with the given registry.

type ProviderDefaults

type ProviderDefaults interface {
	// GetImageID returns the default image ID for the specified OS version
	GetImageID(osVersion string) string

	// GetAvailabilityZones returns the default availability zones for the region
	GetAvailabilityZones() []string

	// GetNTPServers returns the default NTP servers for the region
	GetNTPServers() []string

	// GetDNSNameservers returns the default DNS nameservers for the region
	GetDNSNameservers() []string

	// GetDefaultStorageClass returns the default storage class for the provider
	GetDefaultStorageClass() string

	// GetDefaultFlavors returns the default instance type flavors
	GetDefaultFlavors() FlavorDefaults
}

ProviderDefaults defines the interface for provider-region specific defaults. Implementations supply context-aware default values based on infrastructure provider and region.

type Registry

type Registry interface {
	// GetDefaults retrieves the defaults for a specific provider-region combination
	GetDefaults(provider, region string) (ProviderDefaults, error)

	// RegisterDefaults registers defaults for a provider-region combination
	RegisterDefaults(provider, region string, defaults ProviderDefaults)

	// ListProviders returns all registered provider names
	ListProviders() []string

	// ListRegions returns all registered regions for a specific provider
	ListRegions(provider string) []string
}

Registry defines the interface for managing provider-region defaults. It maintains a registry of ProviderDefaults implementations keyed by provider and region.

func GetGlobalRegistry

func GetGlobalRegistry() Registry

GetGlobalRegistry returns the singleton global registry instance.

func NewRegistry

func NewRegistry() Registry

NewRegistry creates a new provider-region defaults registry.

Jump to

Keyboard shortcuts

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