Documentation ¶
Index ¶
- type ClustermodOptions
- type CtxmodOptions
- type ExportOptions
- type ImportOptions
- type KubeConfig
- func (kc *KubeConfig) ChangeCluster(context, cluster string) error
- func (kc *KubeConfig) ChangeNamespace(context, namespace string) error
- func (c *KubeConfig) ChangeUser(context, user string) error
- func (c *KubeConfig) Chusr(context, user string) error
- func (c *KubeConfig) Clustermod(clusterName string, opts *ClustermodOptions) error
- func (kc *KubeConfig) Export(contextName string, opts *ExportOptions) (*KubeConfig, error)
- func (kc *KubeConfig) GetAllNamespaces(context string) ([]string, error)
- func (kc *KubeConfig) GetCluster(name string) *apiv1.NamedCluster
- func (kc *KubeConfig) GetContext(name string) *apiv1.NamedContext
- func (kc *KubeConfig) GetCurrentContext() *apiv1.NamedContext
- func (kc *KubeConfig) GetPath() string
- func (kc *KubeConfig) GetUser(name string) *apiv1.NamedAuthInfo
- func (kc *KubeConfig) Import(src *KubeConfig, opts *ImportOptions)
- func (kc *KubeConfig) Remove(contextName string)
- func (kc *KubeConfig) Rename(src, dest string)
- func (c *KubeConfig) RenameCluster(src, dest string)
- func (kc *KubeConfig) RenameUser(src, dest string)
- func (kc *KubeConfig) Save() error
- func (kc *KubeConfig) SaveAs(path string) error
- func (kc *KubeConfig) Split() []*KubeConfig
- func (c *KubeConfig) Usermod(userName string, opts *UsermodOptions) error
- func (kc *KubeConfig) WriteTo(w io.Writer) error
- type OpenError
- type UsermodOptions
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 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 ¶
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
type OpenError ¶
type OpenError struct {
// contains filtered or unexported fields
}
this error is occured while Open() execution