kubediscover

package
v1.36.2 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 5 Imported by: 0

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

func Contexts() []Context

Contexts merges the kubeconfig path list (first-file-wins for duplicate context names, matching kubectl) and returns the contexts with the current-context marked.

Jump to

Keyboard shortcuts

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