kubeconfig

package
v0.0.0-...-8e53d61 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 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

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

func RemoveContext(kubeconfigPath, contextName string) error

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

Jump to

Keyboard shortcuts

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