Documentation
¶
Index ¶
- Variables
- func DetectAndSetRoot(cmd *cobra.Command, args []string) error
- func DetectAndSetRootFromFiles(filePaths []string) error
- func DetectProjectRoot(startDir string) (string, error)
- func DetectProjectRootForFile(filePath string) (string, error)
- func DetectRootForTemplate(templatePath string) (string, error)
- func EnsureTalosconfigPath(cmd *cobra.Command)
- func ExpandFilePaths(paths []string) ([]string, error)
- func ResolveSecretsPath(withSecrets string) string
- func ValidateAndDetectRootsForFiles(filePaths []string) (string, error)
- func WithClient(action func(context.Context, *client.Client) error, ...) error
- func WithClientAuto(action func(context.Context, *client.Client) error) error
- func WithClientMaintenance(enforceFingerprints []string, ...) error
- func WithClientNoNodes(action func(context.Context, *client.Client) error, ...) error
- func WithClientSkipVerify(action func(context.Context, *client.Client) error) error
Constants ¶
This section is empty.
Variables ¶
var Commands []*cobra.Command
Commands is a list of commands published by the package.
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 } }
var GlobalArgs global.Args
GlobalArgs is the common arguments for the root command.
Functions ¶
func DetectAndSetRoot ¶ added in v0.18.1
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
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
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
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
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
EnsureTalosconfigPath ensures talosconfig path is set to project root if not explicitly set via flag.
func ExpandFilePaths ¶ added in v0.19.0
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
ResolveSecretsPath resolves secrets.yaml path relative to project root if not absolute.
func ValidateAndDetectRootsForFiles ¶ added in v0.18.1
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
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
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.