Documentation
¶
Index ¶
- Variables
- func ContainContext(element interface{}) gotypes.GomegaMatcher
- func GetRestConfig(config *KConf) (*rest.Config, error)
- func HasPipeData() bool
- func Read(filepath string) (*clientcmdapi.Config, error)
- type Configurable
- type ContainContextMatcher
- type KConf
- func (k *KConf) AddCluster(name string, cluster *clientcmdapi.Cluster) string
- func (k *KConf) AddContext(name string, context *clientcmdapi.Context) string
- func (k *KConf) AddUser(name string, user *clientcmdapi.AuthInfo) string
- func (k *KConf) Export(name string) (*clientcmdapi.Config, error)
- func (k *KConf) GetContent(name string) ([]byte, error)
- func (k *KConf) List() ([]string, string)
- func (k *KConf) Merge(config *clientcmdapi.Config, name string)
- func (k *KConf) MoveContext(oldName, newName string) error
- func (k *KConf) Remove(name string) error
- func (k *KConf) Save() error
- func (k *KConf) SetCurrentContext(contextName string) error
- func (k *KConf) SetNamespace(contextName, namespace string) error
Constants ¶
This section is empty.
Variables ¶
var MainConfigPath string
MainConfigPath is the file path to the main config
var Out zerolog.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stdout, PartsExclude: []string{"time", "level"}})
Out is for printing to stdout using zerolog
Functions ¶
func ContainContext ¶
func ContainContext(element interface{}) gotypes.GomegaMatcher
ContainContext is the Gomega matcher function
func GetRestConfig ¶
GetRestConfig returns a rest.Config from a KConf type
func HasPipeData ¶
func HasPipeData() bool
HasPipeData returns true if kconf is receiving data from stdin pipe
Types ¶
type Configurable ¶
type Configurable interface { AddContext() bool AddCluster() bool AddUser() bool // contains filtered or unexported methods }
Configurable can validate and modify its own kubeconfig attributes
type ContainContextMatcher ¶
type ContainContextMatcher struct {
Element interface{}
}
ContainContextMatcher gets returned by the matcher function
func (*ContainContextMatcher) FailureMessage ¶
func (matcher *ContainContextMatcher) FailureMessage(actual interface{}) (message string)
FailureMessage displays when the context is not found but should be
func (*ContainContextMatcher) Match ¶
func (matcher *ContainContextMatcher) Match(actual interface{}) (bool, error)
Match looks in a kubeconfig for a matching Context
func (*ContainContextMatcher) NegatedFailureMessage ¶
func (matcher *ContainContextMatcher) NegatedFailureMessage(actual interface{}) (message string)
NegatedFailureMessage displays when the context is found but shouldn't be
type KConf ¶
type KConf struct {
clientcmdapi.Config
}
KConf is a kubeconfig mixed with some useful functions
func (*KConf) AddCluster ¶
func (k *KConf) AddCluster(name string, cluster *clientcmdapi.Cluster) string
AddCluster attempts to add a Cluster and return the resulting name
func (*KConf) AddContext ¶
func (k *KConf) AddContext(name string, context *clientcmdapi.Context) string
AddContext attempts to add a Context and return the resulting name
func (*KConf) AddUser ¶
func (k *KConf) AddUser(name string, user *clientcmdapi.AuthInfo) string
AddUser attempts to add an AuthInfo and return the resulting name
func (*KConf) Export ¶
func (k *KConf) Export(name string) (*clientcmdapi.Config, error)
Export returns a single context's config from a kubeconfig file
func (*KConf) GetContent ¶
GetContent converts a single config into writeable content
func (*KConf) Merge ¶
func (k *KConf) Merge(config *clientcmdapi.Config, name string)
Merge takes a config and combines it into a config file
func (*KConf) MoveContext ¶
MoveContext renames an existing context
func (*KConf) SetCurrentContext ¶
SetCurrentContext sets the kubeconfig current context to `currentContext`
func (*KConf) SetNamespace ¶
SetNamespace sets the namespace for the context `contextName`