Documentation
¶
Index ¶
- type KubeConfig
- func (k *KubeConfig) GetContext() (string, error)
- func (k *KubeConfig) HandleErrors() error
- func (k *KubeConfig) IsExpired(context string) (bool, error)
- func (k *KubeConfig) MemberOfGroup(context string, group string) (bool, error)
- func (k *KubeConfig) MergeYaml(yaml []byte) *KubeConfig
- func (k *KubeConfig) RemoveExpiredContexts() []string
- func (k *KubeConfig) SetContext(context string) *KubeConfig
- func (k *KubeConfig) SetNamespace(namespace string) *KubeConfig
- func (k *KubeConfig) Write() error
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 (*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) MemberOfGroup ¶ added in v1.15.3
func (k *KubeConfig) MemberOfGroup(context string, group string) (bool, error)
func (*KubeConfig) MergeYaml ¶
func (k *KubeConfig) MergeYaml(yaml []byte) *KubeConfig
LoadFromBytes loads the kubeconfig file
func (*KubeConfig) RemoveExpiredContexts ¶ added in v1.20.3
func (k *KubeConfig) RemoveExpiredContexts() []string
RemoveExpiredContexts removes every context whose token has expired, prunes the user and cluster entries that are left unreferenced and clears the current context if it was removed. It returns the names of the removed contexts, sorted. Contexts without a token (for example client-certificate or exec based auth) are never considered expired and are left untouched.
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