kubeconfig

package
v5.12.0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package kubeconfig provides kubeconfig path resolution utilities.

This package contains helpers for resolving and expanding kubeconfig paths from cluster configurations or defaults, with support for tilde expansion.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDefaultPath

func GetDefaultPath() string

GetDefaultPath returns the default kubeconfig path for the current user. The path is constructed as ~/.kube/config using the user's home directory.

func GetPathFromConfig

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

GetPathFromConfig 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 from GetDefaultPath.

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 GetPathSilently

func GetPathSilently() string

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

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.

Types

This section is empty.

Jump to

Keyboard shortcuts

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