Help us shape the future of Go! Take the 2026 Go Developer Survey

kubeconfig

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KubeConfig

type KubeConfig struct {
	Config *clientcmdapi.Config
	Path   string
	Errors []error
}

KubeConfig is the kubeconfig file

func LoadFromDefaultFile

func LoadFromDefaultFile() (*KubeConfig, error)

NewKubeConfig loads the kubeconfig file

func LoadFromFile

func LoadFromFile(path string) (*KubeConfig, error)

LoadFromFile loads the kubeconfig file

func LoadOrNewKubeConfig

func LoadOrNewKubeConfig() *KubeConfig

LoadOrNewKubeConfig loads the kubeconfig file or creates a new one

func MustLoadFromDefaultFile

func MustLoadFromDefaultFile() *KubeConfig

LoadKubeConfig loads the kubeconfig file

func MustLoadFromFile

func MustLoadFromFile(path string) *KubeConfig

LoadFromFile loads the kubeconfig file

func NewKubeConfig

func NewKubeConfig() *KubeConfig

NewKubeConfig loads the kubeconfig file

func (*KubeConfig) GetContext

func (k *KubeConfig) GetContext() (string, error)

GetCurrentContext gets the current context

func (*KubeConfig) HandleErrors

func (k *KubeConfig) HandleErrors() error

Handle errors return a string of errors

func (*KubeConfig) IsExpired

func (k *KubeConfig) IsExpired(context string) (bool, error)

IsExpired check if the selected contexts token is expired

func (*KubeConfig) MergeYaml

func (k *KubeConfig) MergeYaml(yaml []byte) *KubeConfig

LoadFromBytes loads the kubeconfig file

func (*KubeConfig) SetContext

func (k *KubeConfig) SetContext(context string) *KubeConfig

SetCurrentContext sets the current context

func (*KubeConfig) SetNamespace added in v0.2.4

func (k *KubeConfig) SetNamespace(namespace string) *KubeConfig

SetNamespace sets the namespace for the current context

func (*KubeConfig) Write

func (k *KubeConfig) Write() error

Write writes the kubeconfig file

Jump to

Keyboard shortcuts

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