Documentation
¶
Overview ¶
Package config contains the config structs and loading logic for Topf
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Endpoint ¶
Endpoint is a wrapper around url.URL that marshals/unmarshals as a string
func (Endpoint) MarshalYAML ¶
MarshalYAML implements yaml.Marshaler to transparently convert url.URL to a string
type Node ¶
type Node struct {
// Host is the name of the node. Can be FQDN or short name
Host string `yaml:"host"`
// IP is optional and used to connect to nodes directly instead of using DNS to resolve "host"
IP *netip.Addr `yaml:"ip,omitempty"`
Role NodeRole `yaml:"role"`
Data map[string]any `yaml:"data,omitempty"`
}
Node is the struct containing the configuration info for a node
type NodeRole ¶
type NodeRole string
NodeRole represents the role of a node in the cluster
func (NodeRole) MarshalText ¶
MarshalText implements encoding.TextMarshaler
func (*NodeRole) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler
type PatchContext ¶
type PatchContext struct {
ClusterName string
ClusterEndpoint string
KubernetesVersion string
Data map[string]any
Node *Node
ConfigDir string
}
PatchContext are the things that can be templated in patches
func (*PatchContext) Load ¶
func (p *PatchContext) Load() (patches []configpatcher.Patch, err error)
Load loads all patches applicable for the node This includes general patches, role (worker/control-plane) specific patches and node specific patches in that order
type TopfConfig ¶
type TopfConfig struct {
ClusterName string `yaml:"clusterName"`
ClusterEndpoint Endpoint `yaml:"clusterEndpoint"`
KubernetesVersion string `yaml:"kubernetesVersion"`
// SecretsProvider can be optionally set to the path of a binary which is
// responsible for storing and retrieving secrets.yaml for a cluster. If not
// set, will use a local secrest.yaml with optinoal SOPS encryption.
SecretsProvider string `yaml:"secretsProvider,omitempty"`
// NodesProvider can be optionally set the path of a binary which will provide additional noddes
NodesProvider string `yaml:"nodesProvider,omitempty"`
// ConfigDir is the directory containing patches and node-specific configurations
// Defaults to "." (current directory) if not specified
ConfigDir string `yaml:"configDir,omitempty"`
Nodes []Node `yaml:"nodes"`
// Data can contain arbitrary data that can be used when templating patches
Data map[string]any `yaml:"data"`
}
TopfConfig is the main configuration structure for a Topf cluster
func LoadFromFile ¶
func LoadFromFile(path string, nodesRegexFilter string) (config *TopfConfig, err error)
LoadFromFile loads the TopfConfig from a YAML file
func (*TopfConfig) GetSecretsProvider ¶
func (t *TopfConfig) GetSecretsProvider() providers.SecretsProvider
GetSecretsProvider returns the configured secrets provider, or the default filesystem provider