kubeconfig

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package kubeconfig provides utilities to manipulate kubeconfig.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddContext

func AddContext(kubeconfigPath, contextName string, config *Config) error

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

func RemoveContext(kubeconfigPath, contextName string) error

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

Jump to

Keyboard shortcuts

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