Documentation
¶
Index ¶
- func ApplyContextDefaults(cmd *cobra.Command) error
- func EnsureContext() error
- func GetDefaultKubeconfigPath() (string, error)
- func GetDefaultKubeconfigWithContext() (string, string, error)
- func GetKubeContextNames(config *clientcmdapi.Config) []string
- func GetKubernetesClient() (client.Client, error)
- func GetStoredKubeConfigValues() (string, string, error)
- func IsConfigFileExists() bool
- func LoadStoredConfig() (*configContext.StoredConfig, error)
- func SaveStoredConfig(cfg *configContext.StoredConfig) error
- type ConfigContextImpl
- func (c *ConfigContextImpl) AddCluster(cluster *configContext.KubernetesCluster) error
- func (c *ConfigContextImpl) GetCluster(name string) (*configContext.KubernetesCluster, error)
- func (c *ConfigContextImpl) GetContexts() error
- func (c *ConfigContextImpl) GetCurrentContext() error
- func (c *ConfigContextImpl) SetContext(params api.SetContextParams) error
- func (c *ConfigContextImpl) UseContext(params api.UseContextParams) error
- type DefaultContextValues
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyContextDefaults ¶
ApplyContextDefaults loads the stored config and sets default flag values from the current context, if not already provided.
func EnsureContext ¶
func EnsureContext() error
EnsureContext creates and sets a default context if none exists.
func GetDefaultKubeconfigPath ¶
GetDefaultKubeconfigPath returns the default kubeconfig path
func GetDefaultKubeconfigWithContext ¶
GetDefaultKubeconfigWithContext returns the default kubeconfig path and its current context
func GetKubeContextNames ¶
func GetKubeContextNames(config *clientcmdapi.Config) []string
GetKubeContextNames returns a sorted list of Kubernetes context names
func GetKubernetesClient ¶
GetKubernetesClient returns a new kubernetes client based on the current context
func GetStoredKubeConfigValues ¶
GetStoredKubeConfigValues returns the kubeconfig path and context from the current context
func IsConfigFileExists ¶
func IsConfigFileExists() bool
IsConfigFileExists checks if the configuration file exists
func LoadStoredConfig ¶
func LoadStoredConfig() (*configContext.StoredConfig, error)
LoadStoredConfig loads the configuration from disk
func SaveStoredConfig ¶
func SaveStoredConfig(cfg *configContext.StoredConfig) error
SaveStoredConfig persists the configuration to disk
Types ¶
type ConfigContextImpl ¶
type ConfigContextImpl struct{}
ConfigContextImpl implements context-related commands.
func NewConfigContextImpl ¶
func NewConfigContextImpl() *ConfigContextImpl
NewConfigContextImpl creates a new instance of ConfigContextImpl.
func (*ConfigContextImpl) AddCluster ¶
func (c *ConfigContextImpl) AddCluster(cluster *configContext.KubernetesCluster) error
func (*ConfigContextImpl) GetCluster ¶
func (c *ConfigContextImpl) GetCluster(name string) (*configContext.KubernetesCluster, error)
func (*ConfigContextImpl) GetContexts ¶
func (c *ConfigContextImpl) GetContexts() error
GetContexts prints all available contexts with their details.
func (*ConfigContextImpl) GetCurrentContext ¶
func (c *ConfigContextImpl) GetCurrentContext() error
GetCurrentContext prints the current context details.
func (*ConfigContextImpl) SetContext ¶
func (c *ConfigContextImpl) SetContext(params api.SetContextParams) error
SetContext creates or updates a configuration context with the given parameters.
func (*ConfigContextImpl) UseContext ¶
func (c *ConfigContextImpl) UseContext(params api.UseContextParams) error
UseContext sets the current context to the context with the given name.