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 ¶ added in v0.3.0
func BuildKubeconfig(conf BuildKubeconfigConfig) *clientcmdapi.Config
BuildKubeconfig builds a kubeconfig file from the given parameters.
func DecodeKubeconfig ¶ added in v0.3.0
func DecodeKubeconfig(data []byte) (*clientcmdapi.Config, error)
DecodeKubeconfig decodes a kubeconfig from bytes
func EncodeKubeconfig ¶ added in v0.3.0
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 ¶ added in v0.3.0
func LoadFromFile(path string) (*clientcmdapi.Config, error)
LoadFromFile loads a kubeconfig from a file
func ModifyContext ¶ added in v0.3.0
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 ¶ added in v0.3.0
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