commands

package
v0.22.4 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Commands []*cobra.Command

Commands is a list of commands published by the package.

View Source
var Config struct {
	RootDir         string
	RootDirExplicit bool // true if --root was explicitly set
	GlobalOptions   struct {
		Talosconfig string `yaml:"talosconfig"`
		Kubeconfig  string `yaml:"kubeconfig"`
	} `yaml:"globalOptions"`
	TemplateOptions struct {
		Offline           bool     `yaml:"offline"`
		ValueFiles        []string `yaml:"valueFiles"`
		Values            []string `yaml:"values"`
		StringValues      []string `yaml:"stringValues"`
		FileValues        []string `yaml:"fileValues"`
		JsonValues        []string `yaml:"jsonValues"`
		LiteralValues     []string `yaml:"literalValues"`
		TalosVersion      string   `yaml:"talosVersion"`
		WithSecrets       string   `yaml:"withSecrets"`
		KubernetesVersion string   `yaml:"kubernetesVersion"`
		Full              bool     `yaml:"full"`
		Debug             bool     `yaml:"debug"`
	} `yaml:"templateOptions"`
	ApplyOptions struct {
		DryRun           bool   `yaml:"preserve"`
		Timeout          string `yaml:"timeout"`
		TimeoutDuration  time.Duration
		CertFingerprints []string `yaml:"certFingerprints"`
	} `yaml:"applyOptions"`
	UpgradeOptions struct {
		Preserve bool `yaml:"preserve"`
		Stage    bool `yaml:"stage"`
		Force    bool `yaml:"force"`
	} `yaml:"upgradeOptions"`
	InitOptions struct {
		Version string
	}
}
View Source
var GlobalArgs global.Args

GlobalArgs is the common arguments for the root command.

Functions

func DetectAndSetRoot added in v0.18.1

func DetectAndSetRoot(cmd *cobra.Command, args []string) error

DetectAndSetRoot detects and sets the project root using fallback strategy: 1. From -f/--file flag (if files specified) 2. From -t/--template flag (if templates specified) 3. From current working directory

func DetectAndSetRootFromFiles added in v0.18.1

func DetectAndSetRootFromFiles(filePaths []string) error

DetectAndSetRootFromFiles detects and sets project root from file paths. This is a common pattern used in commands like apply, upgrade, and talosctl wrapper. It detects root from files if provided, otherwise falls back to current working directory.

func DetectProjectRoot added in v0.18.1

func DetectProjectRoot(startDir string) (string, error)

DetectProjectRoot automatically detects the project root directory by looking for Chart.yaml and secrets.yaml (or secrets.encrypted.yaml) files in the current directory and parent directories. Returns the absolute path to the project root, or empty string if not found.

func DetectProjectRootForFile added in v0.18.1

func DetectProjectRootForFile(filePath string) (string, error)

DetectProjectRootForFile detects the project root for a given file path. It finds the directory containing the file, then searches up for Chart.yaml and secrets.yaml.

func DetectRootForTemplate added in v0.18.1

func DetectRootForTemplate(templatePath string) (string, error)

DetectRootForTemplate detects the project root for a template file path. Similar to ValidateAndDetectRootsForFiles but for a single template file.

func EnsureTalosconfigPath added in v0.18.1

func EnsureTalosconfigPath(cmd *cobra.Command)

EnsureTalosconfigPath ensures talosconfig path is set to project root if not explicitly set via flag.

func ExpandFilePaths added in v0.19.0

func ExpandFilePaths(paths []string) ([]string, error)

ExpandFilePaths expands file paths: if a path is a directory, finds all YAML files in it. Returns a list of file paths, with directories expanded to their YAML files.

func ResolveSecretsPath added in v0.18.1

func ResolveSecretsPath(withSecrets string) string

ResolveSecretsPath resolves secrets.yaml path relative to project root if not absolute.

func ValidateAndDetectRootsForFiles added in v0.18.1

func ValidateAndDetectRootsForFiles(filePaths []string) (string, error)

ValidateAndDetectRootsForFiles validates that all files belong to the same project root. Returns the common root directory and an error if files belong to different roots.

func WithClient

func WithClient(action func(context.Context, *client.Client) error, dialOptions ...grpc.DialOption) error

WithClient builds upon WithClientNoNodes to provide set of nodes on request context based on config & flags.

func WithClientAuto added in v0.21.0

func WithClientAuto(action func(context.Context, *client.Client) error) error

WithClientAuto automatically selects the appropriate client wrapper based on GlobalArgs.SkipVerify. If SkipVerify is true, uses WithClientSkipVerify, otherwise uses WithClientNoNodes.

func WithClientMaintenance

func WithClientMaintenance(enforceFingerprints []string, action func(context.Context, *client.Client) error) error

WithClientMaintenance wraps common code to initialize Talos client in maintenance (insecure mode).

func WithClientNoNodes

func WithClientNoNodes(action func(context.Context, *client.Client) error, dialOptions ...grpc.DialOption) error

WithClientNoNodes wraps common code to initialize Talos client and provide cancellable context.

WithClientNoNodes doesn't set any node information on the request context.

func WithClientSkipVerify added in v0.21.0

func WithClientSkipVerify(action func(context.Context, *client.Client) error) error

WithClientSkipVerify wraps common code to initialize Talos client with TLS verification disabled but with client certificate authentication preserved. This is useful when connecting to nodes via IP addresses not listed in the server certificate's SANs.

Types

This section is empty.

Jump to

Keyboard shortcuts

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