config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyContextDefaults

func ApplyContextDefaults(cmd *cobra.Command) error

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

func GetDefaultKubeconfigPath() (string, error)

GetDefaultKubeconfigPath returns the default kubeconfig path

func GetDefaultKubeconfigWithContext

func GetDefaultKubeconfigWithContext() (string, string, error)

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

func GetKubernetesClient() (client.Client, error)

GetKubernetesClient returns a new kubernetes client based on the current context

func GetStoredKubeConfigValues

func GetStoredKubeConfigValues() (string, string, error)

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 (*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.

type DefaultContextValues

type DefaultContextValues struct {
	ContextName  string
	Organization string
	Project      string
	DataPlane    string
	Environment  string
	ClusterName  string
}

DefaultContextValues defines default values for context initialization

Jump to

Keyboard shortcuts

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