kconf

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClustermodOptions

type ClustermodOptions struct {
	ServerURL string
}

type CtxmodOptions

type CtxmodOptions struct {
	Cluster string
	User    string
}

type ExportOptions added in v0.4.4

type ExportOptions struct {
	As string
}

type ImportOptions added in v0.4.4

type ImportOptions struct {
	As string
}

type KubeConfig

type KubeConfig struct {
	*apiv1.Config
	// contains filtered or unexported fields
}

func New

func New() *KubeConfig

func Open

func Open(path string) (kc *KubeConfig, err error)

open the given file and returns KubeConfig instance. If given file is empty string, the function will load kubeconfig from KUBECONFIG env. variable. If KUBECONFIG variable is not set, then the function open default ~/.kube/config file.

func OpenBase64

func OpenBase64(b64Data []byte) (*KubeConfig, error)

OpenBase64 will decode input data from base64 and parse it

func OpenData

func OpenData(data []byte) (*KubeConfig, error)

parse given data as YAML into new KubeConfig

func (*KubeConfig) ChangeCluster added in v0.5.0

func (kc *KubeConfig) ChangeCluster(context, cluster string) error

change cluster for given context. If context is empty string, then the current context will be used

func (*KubeConfig) ChangeNamespace added in v0.5.0

func (kc *KubeConfig) ChangeNamespace(context, namespace string) error

change default namespace for given context. If given context is empty string, then the current context of kubeconfig will be used

func (*KubeConfig) ChangeUser added in v0.5.0

func (c *KubeConfig) ChangeUser(context, user string) error

change user for given context. If context is empty string, then the current context will be used

func (*KubeConfig) Chusr

func (c *KubeConfig) Chusr(context, user string) error

change user for given context. If context is empty string, then the current context will be used

func (*KubeConfig) Clustermod

func (c *KubeConfig) Clustermod(clusterName string, opts *ClustermodOptions) error

changing clusters's parameters

func (*KubeConfig) Export

func (kc *KubeConfig) Export(contextName string, opts *ExportOptions) (*KubeConfig, error)

Export returns you new KubeConfig where is given context with required User and Cluster. If contextName is empty string, then the current context will be exported

func (*KubeConfig) GetAllNamespaces added in v0.4.6

func (kc *KubeConfig) GetAllNamespaces(context string) ([]string, error)

func (*KubeConfig) GetCluster

func (kc *KubeConfig) GetCluster(name string) *apiv1.NamedCluster

func (*KubeConfig) GetContext

func (kc *KubeConfig) GetContext(name string) *apiv1.NamedContext

get context by name. If name is empty string, then it returns you current context

func (*KubeConfig) GetCurrentContext added in v0.5.0

func (kc *KubeConfig) GetCurrentContext() *apiv1.NamedContext

func (*KubeConfig) GetPath added in v0.5.0

func (kc *KubeConfig) GetPath() string

func (*KubeConfig) GetUser

func (kc *KubeConfig) GetUser(name string) *apiv1.NamedAuthInfo

func (*KubeConfig) Import

func (kc *KubeConfig) Import(src *KubeConfig, opts *ImportOptions)

Import all users, contexts and clusters from src kubeconfig to current kubeconfig

func (*KubeConfig) Remove

func (kc *KubeConfig) Remove(contextName string)

completely remove context by name and context's cluster and user

func (*KubeConfig) Rename

func (kc *KubeConfig) Rename(src, dest string)

rename context and context's cluster and user. Both cluster and user will have name same as is new name of context

func (*KubeConfig) RenameCluster added in v0.5.0

func (c *KubeConfig) RenameCluster(src, dest string)

func (*KubeConfig) RenameUser added in v0.5.0

func (kc *KubeConfig) RenameUser(src, dest string)

func (*KubeConfig) Save

func (kc *KubeConfig) Save() error

save the KubeConfig into original file as YAML This function works only when KubeConfig was open via Open() function

func (*KubeConfig) SaveAs added in v0.5.0

func (kc *KubeConfig) SaveAs(path string) error

func (*KubeConfig) Split

func (kc *KubeConfig) Split() []*KubeConfig

split one kubeconfig into smaller kubeconfig pieces for each context

func (*KubeConfig) Usermod

func (c *KubeConfig) Usermod(userName string, opts *UsermodOptions) error

changing user's parameters

func (*KubeConfig) WriteTo

func (kc *KubeConfig) WriteTo(w io.Writer) error

write the KubeConfig into writer as YAML. It's used when you need print the KubeConfig YAML into standard output etc.

type OpenError

type OpenError struct {
	// contains filtered or unexported fields
}

this error is occured while Open() execution

func (*OpenError) Error

func (e *OpenError) Error() string

func (*OpenError) Unwrap

func (e *OpenError) Unwrap() error

type UsermodOptions

type UsermodOptions struct {
	Token                 string
	ClientCertificateFile string
	ClientKeyFile         string
}

Jump to

Keyboard shortcuts

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