Documentation
¶
Overview ¶
Package kubediscover enumerates kube contexts from the kubeconfig file(s) referenced by KUBECONFIG (OS-list-separated) or ~/.kube/config. Pure reads with no cluster I/O: every failure (missing file, unreadable, malformed YAML) degrades to "no contexts" so discovery can never block pane creation. Only context names, default namespaces, and current-context are parsed — clusters, users, and credentials are ignored. Context names/namespaces are stripped of control characters (a kubeconfig is user-controlled but may be symlinked/synced from elsewhere) so a hostile value cannot inject terminal escape sequences into the TUI or the spawned --context argument.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func KubeconfigPaths ¶
func KubeconfigPaths() []string
KubeconfigPaths returns the resolved kubeconfig precedence list: KUBECONFIG split on the OS list separator if set, else ~/.kube/config. Exported for testing.
Types ¶
type Context ¶
type Context struct {
Name string // value passed to k9s --context
Namespace string // default namespace for the context; may be empty
Current bool // true if this is the kubeconfig's current-context
}
Context is one entry enumerated from the kubeconfig file(s).
func Contexts ¶
Contexts merges the kubeconfig path list (first-file-wins for duplicate context names, matching kubectl) and returns the contexts with the current-context marked. ctx is checked before each kubeconfig file is read. Cancellation yields the contexts already parsed, matching this package's degrade-to-empty contract for every other failure.