Documentation
¶
Index ¶
- func GetContextNameByClusterName(ctx context.Context, clusterName string) (string, error)
- func GetCurrentContext(ctx context.Context) (string, error)
- func GetDefaultKubeConfigPath(ctx context.Context) (string, error)
- func GetKubeConfigPath(ctx context.Context) (string, error)
- func GetUserNameByContextName(ctx context.Context, userName string) (string, error)
- func IsFilePathLoadableByKubectl(ctx context.Context, path string) (isLoadable bool, err error)
- func ListContextNamesUsingKubectl(ctx context.Context, path string) (contextNames []string, err error)
- func SetCurrentContext(ctx context.Context, contextToUse string) error
- type KubeConfig
- func LoadFromFile(ctx context.Context, file filesinterfaces.File) (config *KubeConfig, err error)
- func LoadFromFilePath(ctx context.Context, path string) (config *KubeConfig, err error)
- func LoadKubeConfig(ctx context.Context) (*KubeConfig, error)
- func MergeConfig(configs ...*KubeConfig) (merged *KubeConfig, err error)
- func (k *KubeConfig) AddClusterAndContextAndUserEntry(cluster *KubeConfigCluster, kubeConfigContext *KubeConfigContext, ...) (err error)
- func (k *KubeConfig) AddClusterEntry(cluster *KubeConfigCluster) (err error)
- func (k *KubeConfig) AddConfig(toAdd *KubeConfig) (err error)
- func (k *KubeConfig) AddContextEntry(kubeConfigContext *KubeConfigContext) (err error)
- func (k *KubeConfig) AddUserEntry(user *KubeConfigUser) (err error)
- func (k *KubeConfig) GetAsYamlString() (yamlSring string, err error)
- func (k *KubeConfig) GetClientKeyDataForUser(name string) (string, error)
- func (k *KubeConfig) GetClusterAndContextAndUserEntryByName(name string) (cluster *KubeConfigCluster, kubeConfigContext *KubeConfigContext, ...)
- func (k *KubeConfig) GetClusterEntryByName(name string) (cluster *KubeConfigCluster, err error)
- func (k *KubeConfig) GetClusterNames() (clusterNames []string, err error)
- func (k *KubeConfig) GetClusterServerUrlAsString(clusterName string) (string, error)
- func (k *KubeConfig) GetContextEntryByName(name string) (kubeConfigContext *KubeConfigContext, err error)
- func (k *KubeConfig) GetContextNameByClusterName(ctx context.Context, clusterName string) (string, error)
- func (k *KubeConfig) GetCurrentContext(ctx context.Context) (string, error)
- func (k *KubeConfig) GetDeepCopy() (copy *KubeConfig)
- func (k *KubeConfig) GetServerNames() (serverNames []string, err error)
- func (k *KubeConfig) GetUserEntryByName(name string) (kubeConfigContext *KubeConfigUser, err error)
- func (k *KubeConfig) GetUserNameByContextName(ctx context.Context, contextName string) (userName string, err error)
- func (k *KubeConfig) ListContextNames(ctx context.Context) ([]string, error)
- func (k *KubeConfig) SetCurrentContext(ctx context.Context, contextToUse string) error
- func (k *KubeConfig) WriteToFile(ctx context.Context, outFile filesinterfaces.File) (err error)
- func (k *KubeConfig) WriteToFileByPath(ctx context.Context, path string) (err error)
- func (k *KubeConfig) WriteToTemporaryFileAndGetPath(ctx context.Context) (tempFilePath string, err error)
- type KubeConfigCluster
- type KubeConfigClusterCluster
- type KubeConfigContext
- type KubeConfigUser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetContextNameByClusterName ¶ added in v0.341.0
func GetCurrentContext ¶ added in v0.414.0
func GetDefaultKubeConfigPath ¶ added in v0.341.0
func GetKubeConfigPath ¶ added in v0.341.0
func GetUserNameByContextName ¶ added in v0.341.0
func IsFilePathLoadableByKubectl ¶
This function does an exec to "kubectl" using the given config file "path". Useful to validate if a written config "path" is understood by "kubectl".
Types ¶
type KubeConfig ¶
type KubeConfig struct { APIVersion string `yaml:"apiVersion"` Kind string `yaml:"kind"` Clusters []KubeConfigCluster `yaml:"clusters"` Contexts []KubeConfigContext `yaml:"contexts"` CurrentContext string `yaml:"current-context"` Users []KubeConfigUser `yaml:"users"` }
func LoadFromFile ¶
func LoadFromFile(ctx context.Context, file filesinterfaces.File) (config *KubeConfig, err error)
func LoadFromFilePath ¶
func LoadFromFilePath(ctx context.Context, path string) (config *KubeConfig, err error)
func LoadKubeConfig ¶ added in v0.341.0
func LoadKubeConfig(ctx context.Context) (*KubeConfig, error)
func MergeConfig ¶
func MergeConfig(configs ...*KubeConfig) (merged *KubeConfig, err error)
func (*KubeConfig) AddClusterAndContextAndUserEntry ¶
func (k *KubeConfig) AddClusterAndContextAndUserEntry(cluster *KubeConfigCluster, kubeConfigContext *KubeConfigContext, user *KubeConfigUser) (err error)
func (*KubeConfig) AddClusterEntry ¶
func (k *KubeConfig) AddClusterEntry(cluster *KubeConfigCluster) (err error)
func (*KubeConfig) AddConfig ¶
func (k *KubeConfig) AddConfig(toAdd *KubeConfig) (err error)
func (*KubeConfig) AddContextEntry ¶
func (k *KubeConfig) AddContextEntry(kubeConfigContext *KubeConfigContext) (err error)
func (*KubeConfig) AddUserEntry ¶
func (k *KubeConfig) AddUserEntry(user *KubeConfigUser) (err error)
func (*KubeConfig) GetAsYamlString ¶
func (k *KubeConfig) GetAsYamlString() (yamlSring string, err error)
func (*KubeConfig) GetClientKeyDataForUser ¶ added in v0.328.0
func (k *KubeConfig) GetClientKeyDataForUser(name string) (string, error)
func (*KubeConfig) GetClusterAndContextAndUserEntryByName ¶
func (k *KubeConfig) GetClusterAndContextAndUserEntryByName(name string) (cluster *KubeConfigCluster, kubeConfigContext *KubeConfigContext, user *KubeConfigUser, err error)
func (*KubeConfig) GetClusterEntryByName ¶
func (k *KubeConfig) GetClusterEntryByName(name string) (cluster *KubeConfigCluster, err error)
func (*KubeConfig) GetClusterNames ¶
func (k *KubeConfig) GetClusterNames() (clusterNames []string, err error)
func (*KubeConfig) GetClusterServerUrlAsString ¶ added in v0.328.0
func (k *KubeConfig) GetClusterServerUrlAsString(clusterName string) (string, error)
func (*KubeConfig) GetContextEntryByName ¶
func (k *KubeConfig) GetContextEntryByName(name string) (kubeConfigContext *KubeConfigContext, err error)
func (*KubeConfig) GetContextNameByClusterName ¶ added in v0.341.0
func (*KubeConfig) GetCurrentContext ¶ added in v0.414.0
func (k *KubeConfig) GetCurrentContext(ctx context.Context) (string, error)
func (*KubeConfig) GetDeepCopy ¶
func (k *KubeConfig) GetDeepCopy() (copy *KubeConfig)
func (*KubeConfig) GetServerNames ¶
func (k *KubeConfig) GetServerNames() (serverNames []string, err error)
func (*KubeConfig) GetUserEntryByName ¶
func (k *KubeConfig) GetUserEntryByName(name string) (kubeConfigContext *KubeConfigUser, err error)
func (*KubeConfig) GetUserNameByContextName ¶
func (*KubeConfig) ListContextNames ¶ added in v0.414.0
func (k *KubeConfig) ListContextNames(ctx context.Context) ([]string, error)
func (*KubeConfig) SetCurrentContext ¶ added in v0.414.0
func (k *KubeConfig) SetCurrentContext(ctx context.Context, contextToUse string) error
func (*KubeConfig) WriteToFile ¶
func (k *KubeConfig) WriteToFile(ctx context.Context, outFile filesinterfaces.File) (err error)
func (*KubeConfig) WriteToFileByPath ¶
func (k *KubeConfig) WriteToFileByPath(ctx context.Context, path string) (err error)
func (*KubeConfig) WriteToTemporaryFileAndGetPath ¶
func (k *KubeConfig) WriteToTemporaryFileAndGetPath(ctx context.Context) (tempFilePath string, err error)
type KubeConfigCluster ¶
type KubeConfigCluster struct { Name string `yaml:"name"` Cluster KubeConfigClusterCluster `yaml:"cluster"` }
func (*KubeConfigCluster) GetServerUrlAsString ¶ added in v0.328.0
func (k *KubeConfigCluster) GetServerUrlAsString() (string, error)
type KubeConfigContext ¶
type KubeConfigContext struct { Name string `yaml:"name"` Context struct { Cluster string `yaml:"cluster"` Namespace string `yaml:"namespace"` User string `yaml:"user"` } `yaml:"context"` }
func (KubeConfigContext) GetUserName ¶
func (k KubeConfigContext) GetUserName() (userName string, err error)
type KubeConfigUser ¶
type KubeConfigUser struct { Name string `yaml:"name"` User struct { ClientCertificateData string `yaml:"client-certificate-data"` ClientKeyData string `yaml:"client-key-data"` Username string `yaml:"username"` Password string `yaml:"password"` } `yaml:"user"` }
func (*KubeConfigUser) GetClientKeyData ¶ added in v0.328.0
func (k *KubeConfigUser) GetClientKeyData() (string, error)
Click to show internal directories.
Click to hide internal directories.