engine

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const CommandNameApply = "talm apply"

CommandNameApply is the CommandName value `talm apply` passes to engine.Render. Exported so pkg/commands/apply.go uses it directly as the source of truth — eliminates the drift class that would otherwise let apply error hints silently start suggesting the non-existent `--offline` flag.

View Source
const CommandNameTemplate = "talm template"

CommandNameTemplate is the CommandName value `talm template` passes to engine.Render. Pinning to a constant lets offlineRemedyFor allow-list `--offline` suggestions (rather than deny-list against known no-offline subcommands) — that way any future subcommand or untested caller that forgets to set CommandName falls through to the safe "fix reachability" remedy instead of getting an `--offline` hint that may not exist for its flow.

Variables

This section is empty.

Functions

func FullConfigProcess

func FullConfigProcess(opts Options, patches []string) (*bundle.Bundle, machine.Type, error)

FullConfigProcess handles the full process of creating and updating the Bundle.

The function performs no I/O that would respect a context; the ctx parameter that callers used to pass in was always discarded inside. Dropping the parameter makes the contract honest. If a future caller needs cancellation (e.g. a future remote configpatcher), reintroduce it as a typed first argument.

func InitializeConfigBundle

func InitializeConfigBundle(opts Options) (*bundle.Bundle, error)

InitializeConfigBundle initializes a Talos configuration bundle from opts.

func MergeFileAsPatch added in v0.25.0

func MergeFileAsPatch(rendered []byte, patchFile string) ([]byte, error)

MergeFileAsPatch overlays the YAML body of patchFile onto rendered using Talos's strategic-merge config patcher.

patchFile is a node file: its first line is the talm modeline (a YAML comment) followed by an arbitrary Talos config patch (typically machine.* fields the user wants pinned per node). When the file contains only the modeline (or is otherwise empty after stripping comments and whitespace) the function returns rendered unchanged — short-circuiting Talos's configpatcher which would otherwise route the empty patch through JSON6902 and reject any multi-document rendered config (the v1.12+ output format) outright.

Note that for non-empty patches the patcher round-trips rendered through its config loader, normalising YAML formatting and dropping comments. This is acceptable for the apply path (the result goes straight to ApplyConfiguration) but unsuitable for human-facing output such as `talm template` — which is why the template subcommand does not call this helper.

func NodeFileHasOverlay added in v0.25.0

func NodeFileHasOverlay(patchFile string) (bool, error)

NodeFileHasOverlay reports whether a node file carries a non-empty per-node body below its modeline. The apply path uses this to reject multi-node node files that would otherwise stamp the same pinned hostname/address/VIP onto every target.

func NormalizeTemplatePath added in v0.19.1

func NormalizeTemplatePath(p string) string

NormalizeTemplatePath converts OS-specific path separators to forward slash. Helm engine's Render() returns map keys with forward slashes regardless of OS, so input paths must be normalized to match.

func Render

func Render(ctx context.Context, c *client.Client, opts Options) ([]byte, error)

Render executes the rendering of templates based on the provided options.

func SerializeConfiguration

func SerializeConfiguration(configBundle *bundle.Bundle, machineType machine.Type) ([]byte, error)

SerializeConfiguration serializes the configuration bundle for machineType.

Types

type Options

type Options struct {
	ValueFiles        []string
	StringValues      []string
	Values            []string
	FileValues        []string
	JsonValues        []string `yaml:"jsonValues"` //nolint:revive // public field name kept for backwards compatibility with existing consumers in pkg/commands/template.go and Chart.yaml
	LiteralValues     []string
	TalosVersion      string
	WithSecrets       string
	Full              bool
	Debug             bool
	Root              string
	Offline           bool
	KubernetesVersion string
	TemplateFiles     []string
	ClusterName       string
	Endpoint          string
	// CommandName names the caller subcommand for error messages such as
	// the one produced by FailIfMultiNodes. Empty value falls back to "talm".
	CommandName string
	// TalosEndpoints carries the addresses dialed by the talos client for
	// chart `lookup` calls. Surfaced through wrapLookupError so failed
	// lookups name the endpoints the operator actually targeted, instead
	// of forcing them to reconstruct from CLI flags / modeline.
	TalosEndpoints []string
}

Options encapsulates all parameters necessary for rendering.

Directories

Path Synopsis
Package engine implements the Go text template engine as needed for Helm.
Package engine implements the Go text template engine as needed for Helm.

Jump to

Keyboard shortcuts

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