topf

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package topf contains the internal implementations of Topf

Index

Constants

View Source
const (
	// DefaultSchematic is the schematic version used by Talos when no
	// extensions or command line flags are defined
	DefaultSchematic = "376567988ad370138ad8b2698212367b8edcb69b5fd68c80be1f2ec7d603b4ba"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

type Node struct {
	Node *config.Node

	MachineStatus runtime.MachineStatusSpec
	Schematic     string
	TalosVersion  string
	ConfigBundle  *bundle.Bundle `yaml:"-"`
	Error         error          `yaml:",omitempty"`
	// contains filtered or unexported fields
}

Node contains runtime state information about a Talos node wrapping the configured Node from Topf config

func (*Node) Apply

func (n *Node) Apply(ctx context.Context, logger *slog.Logger, confirm, dryRun bool) (bool, error)

Apply applies the configuration bundle to the node. If dryRun is true, only shows what changes would be applied without actually applying them.

func (*Node) Attrs

func (n *Node) Attrs() slog.Attr

Attrs returns a key/value for use with slog.Logger.With

func (*Node) Client

func (n *Node) Client(ctx context.Context) (*client.Client, error)

Client returns a talos API client, either insecure (if maintenance mode) or authenticated (if bootstrapped already) by probing the node endpoint for mTLS.

func (*Node) ConfigProvider

func (n *Node) ConfigProvider() talosconfig.Provider

ConfigProvider returns the config bundle associated with the node's role

func (*Node) MarshalYAML

func (n *Node) MarshalYAML() (any, error)

MarshalYAML implements custom YAML marshalling to properly serialize the Error field

func (*Node) Stabilize

func (n *Node) Stabilize(ctx context.Context, logger *slog.Logger, stabilizationDuration time.Duration) error

Stabilize waits for the talos machine to be stable (running and ready) for a given duration

type RuntimeConfig

type RuntimeConfig struct {
	// ConfigPath is the path to the topf.yaml configuration file
	ConfigPath string

	// NodesRegexFilter is an optional regex pattern to filter which nodes to operate on
	// Empty string means all nodes
	NodesRegexFilter string

	// LogLevel sets the logging verbosity (debug, info, warn, error)
	LogLevel string
}

RuntimeConfig contains configuration for creating a Topf runtime

type Topf

type Topf interface {
	// Config returns the cluster configuration
	Config() *config.TopfConfig

	// Secrets returns the lazy loaded secrets bundle
	Secrets() (*secrets.Bundle, error)

	// Logger returns the configured logger
	Logger() *slog.Logger

	// Nodes returns the list of nodes with additional information
	Nodes(context.Context) ([]*Node, error)
}

Topf is the main interface to interact with a Topf cluster runtime

func NewTopfRuntime

func NewTopfRuntime(cfg RuntimeConfig) (Topf, error)

NewTopfRuntime creates a new Topf runtime from the given configuration

Jump to

Keyboard shortcuts

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