kubeconfig

package
v5.99.1 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: Apache-2.0 Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package kubeconfig provides helpers for resolving kubeconfig file paths.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetKubeconfigPathFromConfig added in v5.30.0

func GetKubeconfigPathFromConfig(cfg *v1alpha1.Cluster) (string, error)

GetKubeconfigPathFromConfig extracts and expands the kubeconfig path from a loaded cluster config. If the config doesn't specify a kubeconfig path, it returns the default path.

The function always expands tilde (~) characters in the path to the user's home directory, regardless of whether the path came from the config or is the default.

Returns an error if path expansion fails.

func GetKubeconfigPathSilently added in v5.30.0

func GetKubeconfigPathSilently(cmd *cobra.Command) string

GetKubeconfigPathSilently attempts to load the KSail config and extract the kubeconfig path without producing any output. All config loading output is suppressed using io.Discard.

When cmd is non-nil, the --config persistent flag is honored so that an explicit config file is used instead of auto-discovery.

This function intentionally avoids NewCommandConfigManager (which calls AddFlagsFromFields) to prevent "flag redefined" panics on commands that already define flags like --kubeconfig. Instead, it resolves the --config flag value directly and passes it to NewConfigManager.

If config loading fails for any reason, this function returns the default kubeconfig path rather than propagating the error. This makes it suitable for scenarios where a best-effort path is acceptable.

func NewSilentConfigManager added in v5.94.0

func NewSilentConfigManager(cmd *cobra.Command) *ksailconfigmanager.ConfigManager

NewSilentConfigManager creates a config manager from the command's --config flag with all output suppressed via io.Discard.

This is a shared helper used by both GetKubeconfigPathSilently and the kubeconfighook package to avoid duplicating flag-resolution boilerplate.

Types

This section is empty.

Jump to

Keyboard shortcuts

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