Documentation ¶
Index ¶
- Constants
- func GetKubeConfigPath() string
- func GetKxConfigPath() string
- type AuthProvider
- type AuthProviderConfig
- type CannotSetContextError
- type Cluster
- type ClusterConf
- type ClusterFilter
- type ClusterUserData
- type Clusters
- type Context
- type ContextConf
- type ContextFilter
- type Contexts
- func (contexts Contexts) GetContext(name string) (*Context, error)
- func (contexts Contexts) GetNamespaceForContext(name string) (string, error)
- func (contexts Contexts) Len() int
- func (contexts Contexts) Less(i, j int) bool
- func (contexts Contexts) SetNamespaceForContext(ctxName, ns string) error
- func (contexts Contexts) Swap(i, j int)
- type CtxNsPair
- type Exec
- type Favorites
- func (favorites Favorites) AddFavorite(name, ctx, ns string)
- func (favorites Favorites) FavoritesForContext(name string) Favorites
- func (favorites Favorites) GetFavorite(name string) (CtxNsPair, bool)
- func (favorites Favorites) IsFavorite(ctx, ns string) (string, bool)
- func (favorites Favorites) String() string
- type KubeConfig
- func (kc KubeConfig) FilterContexts(filter ContextFilter) Contexts
- func (kc KubeConfig) GetClusterUserData(ctxName string) (*ClusterUserData, error)
- func (kc KubeConfig) GetContext(name string) (*Context, error)
- func (kc KubeConfig) GetCurrentContext() (*Context, error)
- func (kc KubeConfig) GetCurrentContextAndNamespace() (CtxNsPair, error)
- func (kc KubeConfig) GetCurrentContextName() string
- func (kc KubeConfig) GetNamespaceForContext(name string) (string, error)
- func (kc KubeConfig) GetNamespaceForCurrentContext() (string, error)
- func (kc KubeConfig) RenameContext(contextName, newName string) error
- func (kc KubeConfig) Save(path string) error
- func (kc *KubeConfig) SetContext(name string)
- func (kc *KubeConfig) SetNamespaceForContext(ctxName, ns string) error
- func (kc *KubeConfig) UseContext(name string) error
- type KxConfig
- func (kx *KxConfig) AddFavorite(name, ctx, ns string) error
- func (kx KxConfig) Changed() bool
- func (kx *KxConfig) FavoritesForContext(name string) Favorites
- func (kx *KxConfig) GetFavorite(name string) (CtxNsPair, bool)
- func (kx *KxConfig) GetPrevious() (CtxNsPair, error)
- func (kx *KxConfig) GetPrompt() *Prompt
- func (kx *KxConfig) IsFavorite(ctx, ns string) (string, bool)
- func (kx KxConfig) Save(path string) error
- func (kx *KxConfig) SetPrevious(pair CtxNsPair) error
- type NoPreviousContextError
- type NoSuchContextError
- type Preferences
- type Prompt
- type User
- type UserConf
- type UserFilter
- type Users
Constants ¶
View Source
const ( KubeConfigEnvVar = "KUBECONFIG" DefaultKubeConfigPath = "~/.kube/config" KxConfigEnvVar = "KXCONFIG" DefaultKxConfigPath = "~/.kx.yaml" )
Variables ¶
This section is empty.
Functions ¶
func GetKubeConfigPath ¶
func GetKubeConfigPath() string
func GetKxConfigPath ¶
func GetKxConfigPath() string
Types ¶
type AuthProvider ¶
type AuthProvider struct { Config AuthProviderConfig `yaml:"config"` Name string `yaml:"name"` }
type AuthProviderConfig ¶
type AuthProviderConfig struct { AccessToken string `yaml:"access-token,omitempty"` CmdArgs string `yaml:"cmd-args,omitempty"` CmdPath string `yaml:"cmd-path,omitempty"` Expiry string `yaml:"expiry,omitempty"` ExpiryKey string `yaml:"expiry-key,omitempty"` TokenKey string `yaml:"token-key,omitempty"` }
type CannotSetContextError ¶
type CannotSetContextError struct {
Message string
}
CannotSetContextError is a custom error type.
func NewCannotSetContextError ¶
func NewCannotSetContextError(name string) CannotSetContextError
NewCannotSetContextError creates a new `CannotSetContextError`.
func (CannotSetContextError) Error ¶
func (e CannotSetContextError) Error() string
type Cluster ¶
type Cluster struct { ClusterConf ClusterConf `yaml:"cluster"` Name string `yaml:"name"` }
type ClusterConf ¶
type ClusterFilter ¶
type ClusterUserData ¶
type ClusterUserData struct { User User `yaml:"user"` Cluster Cluster `yaml:"cluster"` Ctx CtxNsPair `yaml:"ctx"` }
func (ClusterUserData) JSON ¶
func (c ClusterUserData) JSON() ([]byte, error)
func (ClusterUserData) YAML ¶
func (c ClusterUserData) YAML() ([]byte, error)
type Clusters ¶
type Clusters []Cluster
func (Clusters) Filter ¶
func (cl Clusters) Filter(filter ClusterFilter) Clusters
type Context ¶
type Context struct { ContextConf ContextConf `yaml:"context"` Name string `yaml:"name"` }
type ContextConf ¶
type ContextFilter ¶
type Contexts ¶
type Contexts []*Context
func (Contexts) GetNamespaceForContext ¶
func (Contexts) SetNamespaceForContext ¶
type CtxNsPair ¶
type Favorites ¶
func (Favorites) AddFavorite ¶
func (Favorites) FavoritesForContext ¶
func (Favorites) GetFavorite ¶
type KubeConfig ¶
type KubeConfig struct { APIVersion string `yaml:"apiVersion"` Clusters Clusters `yaml:"clusters"` Contexts Contexts `yaml:"contexts"` CurrentContext string `yaml:"current-context"` Kind string `yaml:"kind"` Preferences Preferences `yaml:"preferences"` Users Users `yaml:"users"` // contains filtered or unexported fields }
func GetDefaultKubeConfig ¶
func GetDefaultKubeConfig() (*KubeConfig, error)
func GetKubeConfig ¶
func GetKubeConfig(path string) (*KubeConfig, error)
func (KubeConfig) FilterContexts ¶
func (kc KubeConfig) FilterContexts(filter ContextFilter) Contexts
func (KubeConfig) GetClusterUserData ¶
func (kc KubeConfig) GetClusterUserData(ctxName string) (*ClusterUserData, error)
func (KubeConfig) GetContext ¶
func (kc KubeConfig) GetContext(name string) (*Context, error)
func (KubeConfig) GetCurrentContext ¶
func (kc KubeConfig) GetCurrentContext() (*Context, error)
func (KubeConfig) GetCurrentContextAndNamespace ¶
func (kc KubeConfig) GetCurrentContextAndNamespace() (CtxNsPair, error)
func (KubeConfig) GetCurrentContextName ¶
func (kc KubeConfig) GetCurrentContextName() string
func (KubeConfig) GetNamespaceForContext ¶
func (kc KubeConfig) GetNamespaceForContext(name string) (string, error)
func (KubeConfig) GetNamespaceForCurrentContext ¶
func (kc KubeConfig) GetNamespaceForCurrentContext() (string, error)
func (KubeConfig) RenameContext ¶
func (kc KubeConfig) RenameContext(contextName, newName string) error
func (KubeConfig) Save ¶
func (kc KubeConfig) Save(path string) error
func (*KubeConfig) SetContext ¶
func (kc *KubeConfig) SetContext(name string)
func (*KubeConfig) SetNamespaceForContext ¶
func (kc *KubeConfig) SetNamespaceForContext(ctxName, ns string) error
func (*KubeConfig) UseContext ¶
func (kc *KubeConfig) UseContext(name string) error
type KxConfig ¶
type KxConfig struct { Path string Prompt Prompt `yaml:"prompt" json:"prompt"` Favorites Favorites `json:"favorites" yaml:"favorites"` Previous CtxNsPair `json:"previous" yaml:"previous"` // contains filtered or unexported fields }
func GetKxConfig ¶
func (*KxConfig) AddFavorite ¶
func (*KxConfig) FavoritesForContext ¶
func (*KxConfig) GetPrevious ¶
func (*KxConfig) SetPrevious ¶
type NoPreviousContextError ¶
type NoPreviousContextError struct {
Message string
}
NoPreviousContextError is a custom error type.
func NewNoPreviousContextError ¶
func NewNoPreviousContextError() NoPreviousContextError
NewNoPreviousContextError creates a new `NoPreviousContextError`.
func (NoPreviousContextError) Error ¶
func (e NoPreviousContextError) Error() string
type NoSuchContextError ¶
type NoSuchContextError struct {
Message string
}
NoSuchContextError is returned when a context cannot be found.
func NewNoSuchContextError ¶
func NewNoSuchContextError(name string) NoSuchContextError
NewNoSuchContextError creates a new `NoSuchContextError`.
func (NoSuchContextError) Error ¶
func (e NoSuchContextError) Error() string
type Preferences ¶
type Preferences struct{}
type Prompt ¶
type Prompt struct { Separator string `yaml:"separator" json:"separator"` LeftWrapper string `yaml:"leftWrapper" json:"leftWrapper"` RightWrapper string `yaml:"rightWrapper" json:"rightWrapper"` ContextColor string `yaml:"contextColor" json:"contextColor"` NamespaceColor string `yaml:"namespaceColor" json:"namespaceColor"` SeparatorColor string `yaml:"separatorColor" json:"separatorColor"` ColorOff string }
func (Prompt) FillColors ¶
type UserConf ¶
type UserConf struct { AuthProvider AuthProvider `yaml:"auth-provider,omitempty"` Password string `yaml:"password,omitempty"` Username string `yaml:"username,omitempty"` Token string `yaml:"token,omitempty"` ClientCertificate string `yaml:"client-certificate,omitempty"` ClientKey string `yaml:"client-key,omitempty"` Exec Exec `yaml:"exec,omitempty"` }
type UserFilter ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.