Documentation ¶
Overview ¶
Package kubeconfig provides utilities to manipulate kubeconfig.
Index ¶
- func AddContext(kubeconfigPath, contextName string, config *Config) error
- func BuildKubeconfig(conf BuildKubeconfigConfig) *clientcmdapi.Config
- func DecodeKubeconfig(data []byte) (*clientcmdapi.Config, error)
- func EncodeKubeconfig(config *clientcmdapi.Config) ([]byte, error)
- func GetRecommendedKubeconfigPath() string
- func LoadFromFile(path string) (*clientcmdapi.Config, error)
- func ModifyContext(kubeconfigPath string, fun func(kubeconfig *clientcmdapi.Config) error) error
- func RemoveContext(kubeconfigPath, contextName string) error
- type BuildKubeconfigConfig
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddContext ¶
AddContext adds a context to the kubeconfig file
func BuildKubeconfig ¶
func BuildKubeconfig(conf BuildKubeconfigConfig) *clientcmdapi.Config
BuildKubeconfig builds a kubeconfig file from the given parameters.
func DecodeKubeconfig ¶
func DecodeKubeconfig(data []byte) (*clientcmdapi.Config, error)
DecodeKubeconfig decodes a kubeconfig from bytes
func EncodeKubeconfig ¶
func EncodeKubeconfig(config *clientcmdapi.Config) ([]byte, error)
EncodeKubeconfig encodes a kubeconfig to bytes
func GetRecommendedKubeconfigPath ¶
func GetRecommendedKubeconfigPath() string
GetRecommendedKubeconfigPath returns the recommended config file based on the current environment
func LoadFromFile ¶
func LoadFromFile(path string) (*clientcmdapi.Config, error)
LoadFromFile loads a kubeconfig from a file
func ModifyContext ¶
func ModifyContext(kubeconfigPath string, fun func(kubeconfig *clientcmdapi.Config) error) error
ModifyContext modifies the kubeconfig file
func RemoveContext ¶
RemoveContext removes a context from the kubeconfig file
Types ¶
type BuildKubeconfigConfig ¶
type BuildKubeconfigConfig struct { ProjectName string SecurePort bool Address string CACrtPath string AdminCrtPath string AdminKeyPath string }
BuildKubeconfigConfig is the configuration for BuildKubeconfig.
type Config ¶
type Config struct { Cluster *clientcmdapi.Cluster User *clientcmdapi.AuthInfo Context *clientcmdapi.Context }
Config is a struct that contains the information needed to create a kubeconfig file