Documentation ¶
Index ¶
- func GetConfigFilePath() string
- func GetContexts(config clientcmdapi.Config) []string
- func GetCurrentContext() (string, string)
- func GetNamespaces() []string
- func GetRawConfig() clientcmdapi.Config
- func IsExistsPrevConfig() (string, bool)
- func SetContext(contex string)
- func SetNamespace(config clientcmdapi.Config, namespace string)
- type PrevConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetConfigFilePath ¶
func GetConfigFilePath() string
GetConfigFilePath if set KUBECONFING than return this or return RecomendedHomeFile (ex. /home/$USER/.kube/config)
func GetContexts ¶
func GetContexts(config clientcmdapi.Config) []string
GetContexts return context names in kubeconfig struct
func GetCurrentContext ¶ added in v1.0.1
GetCurrentContext is return current-context and this context's namespace
func GetNamespaces ¶
func GetNamespaces() []string
GetNamespaces is accessing current context and returning all namespace name
func GetRawConfig ¶
func GetRawConfig() clientcmdapi.Config
GetRawConfig is return kubeconfig struct, if have a multiple kubeconfig before merged later return struct
func IsExistsPrevConfig ¶ added in v1.0.1
IsExistsPrevConfig checker Prevconfig exists and return bool,configPath
func SetContext ¶
func SetContext(contex string)
SetContext Change current context in first file if setting KUBECONFIG env,because kubectl look first file in KUBECONFIG env ,if not set env than looking home config
func SetNamespace ¶
func SetNamespace(config clientcmdapi.Config, namespace string)
SetNamespace is changed current namespace for current context, if have a multiple kubeconfig, searching context name in KUBECONFIG env later writing to founded ConfigPath
Types ¶
type PrevConfig ¶ added in v1.0.1
type PrevConfig struct { PrevContext string `yaml:"PrevContext"` PrevNamespace string `yaml:"PrevNamespace"` }
PrevConfig Previous Context and Namespace storage type
func GetPrevConfig ¶ added in v1.0.1
func GetPrevConfig() PrevConfig
GetPrevConfig return PrevConfig struct, if PrevConfig not exists than create empty config
func (*PrevConfig) SetContextPrevConfig ¶ added in v1.0.1
func (config *PrevConfig) SetContextPrevConfig(context string)
SetContextPrevConfig is change prev context and empty namespace
func (*PrevConfig) SetNamespacePrevConfig ¶ added in v1.0.1
func (config *PrevConfig) SetNamespacePrevConfig(namespace string)
SetNamespacePrevConfig is changer prev namespace
func (*PrevConfig) WriteFile ¶ added in v1.0.1
func (config *PrevConfig) WriteFile()
WriteFile is save current PrevConfig struct to file