kubeconfig

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: GPL-3.0 Imports: 6 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// GroupAPI is the group API scope use in this package
	GroupAPI = "sxlibs.k8s.startx.fr"
	// GroupName is the group name use in this package
	GroupName = "kubeconfig"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Kubeconfig

type Kubeconfig struct {
	Config string
	Path   string
	// contains filtered or unexported fields
}

Kubeconfig is a wrapper around api.Config

func NewKubeConfig

func NewKubeConfig() *Kubeconfig

Initialize a kubeconfig object ex:

kubeconfig := kc.NewKubeConfig()

func (*Kubeconfig) Debug

func (kc *Kubeconfig) Debug() *Kubeconfig

Return a display of the current object ex:

kc.Debug()

func (*Kubeconfig) GetConfig

func (kc *Kubeconfig) GetConfig() string

Get the native kubeconfig object ex:

kc := NewKubeConfig().Get()

func (*Kubeconfig) GetConfigBytes

func (kc *Kubeconfig) GetConfigBytes() ([]byte, error)

Get the native kubeconfig object returned in bytes ex:

kc := NewKubeConfig().GetConfigBytes()

func (*Kubeconfig) GetPath

func (kc *Kubeconfig) GetPath() string

Get the path to the kubeconfig object returned in yaml ex:

kc := NewKubeConfig().GetPath()

func (*Kubeconfig) GetYaml

func (kc *Kubeconfig) GetYaml() string

Get the native kubeconfig object returned in yaml ex:

kc := NewKubeConfig().GetYaml()

func (*Kubeconfig) Load

func (kc *Kubeconfig) Load() *Kubeconfig

Automatic search of an available kubeconfig ex:

kc.Load()

func (*Kubeconfig) LoadFromEnv

func (kc *Kubeconfig) LoadFromEnv(fatal bool) (*Kubeconfig, error)

Loading from the KUBECONFIG env var ex:

err := kc.LoadFromEnv()

func (*Kubeconfig) LoadFromFile

func (kc *Kubeconfig) LoadFromFile(filePath string) (*Kubeconfig, error)

Loading Kubeconfig from a file ex:

err := kc.LoadFromFile("/my/path/kubeconfig")

func (*Kubeconfig) LoadFromHome

func (kc *Kubeconfig) LoadFromHome() (*Kubeconfig, error)

Loading kubeconfig from the ~/.kube/config ex:

err := kc.LoadFromHome()

func (*Kubeconfig) LoadFromString

func (kc *Kubeconfig) LoadFromString(yamlString string) *Kubeconfig

Loading kubeconfig from a YAML string ex:

yamlString := `your YAML string here`
err := kc.LoadFromString(yamlString)

func (*Kubeconfig) LoadFromYaml

func (kc *Kubeconfig) LoadFromYaml(yamlData []byte) *Kubeconfig

Loading kubeconfig from YAML content ex:

yamlData := []byte(`your YAML data here`)
err := kc.LoadFromYaml(yamlData)

Jump to

Keyboard shortcuts

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