Documentation ¶
Index ¶
- Constants
- Variables
- func AsColor(c string) tcell.Color
- func EnsurePath(path string, mod os.FileMode)
- func InList(ll []string, n string) bool
- func InNSList(nn []interface{}, ns string) bool
- func MustK9sUser() string
- type Alias
- type Aliases
- type Auth
- type Bench
- type BenchConfig
- type Benchmark
- type Benchmarks
- type Body
- type Border
- type Cluster
- type Config
- func (c *Config) ActiveNamespace() string
- func (c *Config) ActiveView() string
- func (c *Config) CurrentCluster() *Cluster
- func (c *Config) Dump(msg string)
- func (c *Config) FavNamespaces() []string
- func (c *Config) GetConnection() client.Connection
- func (c *Config) Load(path string) error
- func (c *Config) Refine(flags *genericclioptions.ConfigFlags) error
- func (c *Config) Reset()
- func (c *Config) Save() error
- func (c *Config) SaveFile(path string) error
- func (c *Config) SetActiveNamespace(ns string) error
- func (c *Config) SetActiveView(view string)
- func (c *Config) SetConnection(conn client.Connection)
- func (c *Config) Validate()
- type Crumb
- type Flags
- type Frame
- type HTTP
- type HotKey
- type HotKeys
- type Info
- type K9s
- type KubeSettings
- type Log
- type Menu
- type Namespace
- type Plugin
- type Plugins
- type ShortNames
- type Status
- type Style
- type StyleListener
- type Styles
- func (s *Styles) AddListener(l StyleListener)
- func (s *Styles) BgColor() tcell.Color
- func (s *Styles) Body() Body
- func (s *Styles) Crumb() Crumb
- func (s *Styles) FgColor() tcell.Color
- func (s *Styles) Frame() Frame
- func (s *Styles) Load(path string) error
- func (s *Styles) RemoveListener(l StyleListener)
- func (s *Styles) Table() Table
- func (s *Styles) Title() Title
- func (s *Styles) Update()
- func (s *Styles) Views() Views
- func (s *Styles) Xray() Xray
- type Table
- type TableHeader
- type Title
- type View
- type Views
- type Xray
- type Yaml
Constants ¶
const ( // DefaultC default concurrency. DefaultC = 1 // DefaultN default number of requests. DefaultN = 200 // DefaultMethod default http verb. DefaultMethod = "GET" )
const ( // DefaultRefreshRate represents the refresh interval. DefaultRefreshRate = 2 // secs // DefaultLogLevel represents the default log level. DefaultLogLevel = "info" // DefaultCommand represents the default command to run. DefaultCommand = "" )
const ( // DefaultDirMod default unix perms for k9s directory. DefaultDirMod os.FileMode = 0755 // DefaultFileMod default unix perms for k9s files. DefaultFileMod os.FileMode = 0644 )
const (
// MaxFavoritesNS number # favorite namespaces to keep in the configuration.
MaxFavoritesNS = 9
)
Variables ¶
var ( // K9sHome represent K9s home directory. K9sHome = filepath.Join(mustK9sHome(), ".k9s") // K9sConfigFile represents K9s config file location. K9sConfigFile = filepath.Join(K9sHome, "config.yml") // K9sLogs represents K9s log. K9sLogs = filepath.Join(os.TempDir(), fmt.Sprintf("k9s-%s.log", MustK9sUser())) // K9sDumpDir represents a directory where K9s screen dumps will be persisted. K9sDumpDir = filepath.Join(os.TempDir(), fmt.Sprintf("k9s-screens-%s", MustK9sUser())) )
var K9sAlias = filepath.Join(K9sHome, "alias.yml")
K9sAlias manages K9s aliases.
var (
// K9sBench the name of the benchmarks config file.
K9sBench = "bench"
)
var K9sHotKeys = filepath.Join(K9sHome, "hotkey.yml")
K9sHotKeys manages K9s hotKeys.
var K9sPlugins = filepath.Join(K9sHome, "plugin.yml")
K9sPlugins manages K9s plugins.
var ( // K9sStylesFile represents K9s skins file location. K9sStylesFile = filepath.Join(K9sHome, "skin.yml") )
Functions ¶
func EnsurePath ¶
EnsurePath ensures a directory exist from the given path.
Types ¶
type Aliases ¶
type Aliases struct {
Alias Alias `yaml:"alias"`
}
Aliases represents a collection of aliases.
func (Aliases) LoadAliases ¶
LoadAliases loads alias from a given file.
func (Aliases) SaveAliases ¶
SaveAliases saves aliases to a given file.
type Bench ¶
type Bench struct {
Benchmarks *Benchmarks `yaml:"benchmarks"`
}
Bench tracks K9s styling options.
type BenchConfig ¶
type BenchConfig struct { C int `yaml:"concurrency"` N int `yaml:"requests"` Auth Auth `yaml:"auth"` HTTP HTTP `yaml:"http"` Name string }
BenchConfig represents a service benchmark.
type Benchmarks ¶
type Benchmarks struct { Defaults Benchmark `yaml:"defaults"` Services map[string]BenchConfig `yam':"services"` Containers map[string]BenchConfig `yam':"containers"` }
Benchmarks tracks K9s benchmarks configuration.
type Body ¶
type Body struct { FgColor string `yaml:"fgColor"` BgColor string `yaml:"bgColor"` LogoColor string `yaml:"logoColor"` }
Body tracks body styles.
type Cluster ¶
Cluster tracks K9s cluster configuration.
func (*Cluster) Validate ¶
func (c *Cluster) Validate(conn client.Connection, ks KubeSettings)
Validate a cluster config.
type Config ¶
type Config struct { K9s *K9s `yaml:"k9s"` // contains filtered or unexported fields }
Config tracks K9s configuration options.
func (*Config) ActiveNamespace ¶
ActiveNamespace returns the active namespace in the current cluster.
func (*Config) ActiveView ¶
ActiveView returns the active view in the current cluster.
func (*Config) CurrentCluster ¶
CurrentCluster fetch the configuration activeCluster.
func (*Config) FavNamespaces ¶
FavNamespaces returns fav namespaces in the current cluster.
func (*Config) GetConnection ¶
func (c *Config) GetConnection() client.Connection
GetConnection return an api server connection.
func (*Config) Refine ¶
func (c *Config) Refine(flags *genericclioptions.ConfigFlags) error
Refine the configuration based on cli args.
func (*Config) Reset ¶
func (c *Config) Reset()
Reset the context to the new current context/cluster. if it does not exist.
func (*Config) SetActiveNamespace ¶
SetActiveNamespace set the active namespace in the current cluster.
func (*Config) SetActiveView ¶
SetActiveView set the currently cluster active view
func (*Config) SetConnection ¶
func (c *Config) SetConnection(conn client.Connection)
SetConnection set an api server connection.
type Crumb ¶
type Crumb struct { FgColor string `yaml:"fgColor"` BgColor string `yaml:"bgColor"` ActiveColor string `yaml:"activeColor"` }
Crumb tracks crumbs styles.
type Flags ¶
type Flags struct { RefreshRate *int LogLevel *string Headless *bool Command *string AllNamespaces *bool }
Flags represents K9s configuration flags.
type Frame ¶
type Frame struct { Title Title `yaml:"title"` Border Border `yaml:"border"` Menu Menu `yaml:"menu"` Crumb Crumb `yaml:"crumbs"` Status Status `yaml:"status"` }
Frame tracks frame styles.
type HTTP ¶
type HTTP struct { Method string `yaml:"method"` Host string `yaml:"host"` Path string `yaml:"path"` HTTP2 bool `yaml:"http2"` Body string `yaml:"body"` Headers http.Header `yaml:"headers"` }
HTTP represents an http request.
type HotKey ¶
type HotKey struct { ShortCut string `yaml:"shortCut"` Description string `yaml:"description"` Command string `yaml:"command"` }
HotKey describes a K9s hotkey.
type HotKeys ¶
HotKeys represents a collection of plugins.
func (HotKeys) LoadHotKeys ¶
LoadHotKeys loads plugins from a given file.
type K9s ¶
type K9s struct { RefreshRate int `yaml:"refreshRate"` Headless bool `yaml:"headless"` LogBufferSize int `yaml:"logBufferSize"` LogRequestSize int `yaml:"logRequestSize"` CurrentContext string `yaml:"currentContext"` CurrentCluster string `yaml:"currentCluster"` FullScreenLogs bool `yaml:"fullScreenLogs"` Clusters map[string]*Cluster `yaml:"clusters,omitempty"` // contains filtered or unexported fields }
K9s tracks K9s configuration options.
func (*K9s) ActiveCluster ¶
ActiveCluster returns the currently active cluster.
func (*K9s) GetRefreshRate ¶
GetRefreshRate returns the current refresh rate.
func (*K9s) OverrideCommand ¶
OverrideCommand set the command manually.
func (*K9s) OverrideHeadless ¶
OverrideHeadless set the headlessness manually.
func (*K9s) OverrideRefreshRate ¶
OverrideRefreshRate set the refresh rate manually.
func (*K9s) Validate ¶
func (k *K9s) Validate(c client.Connection, ks KubeSettings)
Validate the current configuration.
type KubeSettings ¶
type KubeSettings interface { // CurrentContextName returns the name of the current context. CurrentContextName() (string, error) // CurrentClusterName returns the name of the current cluster. CurrentClusterName() (string, error) // CurrentNamespace returns the name of the current namespace. CurrentNamespaceName() (string, error) // ClusterNames() returns all available cluster names. ClusterNames() ([]string, error) // NamespaceNames returns all available namespace names. NamespaceNames(nn []v1.Namespace) []string }
KubeSettings exposes kubeconfig context information.
type Menu ¶
type Menu struct { FgColor string `yaml:"fgColor"` KeyColor string `yaml:"keyColor"` NumKeyColor string `yaml:"numKeyColor"` }
Menu tracks menu styles.
type Namespace ¶
Namespace tracks active and favorites namespaces.
func NewNamespace ¶
func NewNamespace() *Namespace
NewNamespace create a new namespace configuration.
func (*Namespace) SetActive ¶
func (n *Namespace) SetActive(ns string, ks KubeSettings) error
SetActive set the active namespace.
func (*Namespace) Validate ¶
func (n *Namespace) Validate(c client.Connection, ks KubeSettings)
Validate a namespace is setup correctly
type Plugin ¶
type Plugin struct { ShortCut string `yaml:"shortCut"` Scopes []string `yaml:"scopes"` Description string `yaml:"description"` Command string `yaml:"command"` Background bool `yaml:"background"` Args []string `yaml:"args"` }
Plugin describes a K9s plugin
type Plugins ¶
Plugins represents a collection of plugins.
func (Plugins) LoadPlugins ¶
LoadPlugins loads plugins from a given file.
type ShortNames ¶
ShortNames represents a collection of shortnames for aliases.
type Status ¶
type Status struct { NewColor string `yaml:"newColor"` ModifyColor string `yaml:"modifyColor"` AddColor string `yaml:"addColor"` ErrorColor string `yaml:"errorColor"` HighlightColor string `yaml:"highlightColor"` KillColor string `yaml:"killColor"` CompletedColor string `yaml:"completedColor"` }
Status tracks resource status styles.
type Style ¶
type Style struct { Body Body `yaml:"body"` Frame Frame `yaml:"frame"` Info Info `yaml:"info"` Table Table `yaml:"table"` Xray Xray `yaml:"xray"` Views Views `yaml:"views"` }
Style tracks K9s styles.
type StyleListener ¶
type StyleListener interface { // StylesChanged notifies listener the skin changed. StylesChanged(*Styles) }
StyleListener represents a skin's listener.
type Styles ¶
type Styles struct { K9s Style `yaml:"k9s"` // contains filtered or unexported fields }
Styles tracks K9s styling options.
func (*Styles) AddListener ¶
func (s *Styles) AddListener(l StyleListener)
AddListener registers a new listener.
func (*Styles) RemoveListener ¶
func (s *Styles) RemoveListener(l StyleListener)
RemoveListener unregister a listener.
type Table ¶
type Table struct { FgColor string `yaml:"fgColor"` BgColor string `yaml:"bgColor"` CursorColor string `yaml:"cursorColor"` MarkColor string `yaml:"markColor"` Header TableHeader `yaml:"header"` }
Table tracks table styles.
type TableHeader ¶
type TableHeader struct { FgColor string `yaml:"fgColor"` BgColor string `yaml:"bgColor"` SorterColor string `yaml:"sorterColor"` }
TableHeader tracks table header styles.
type Title ¶
type Title struct { FgColor string `yaml:"fgColor"` BgColor string `yaml:"bgColor"` HighlightColor string `yaml:"highlightColor"` CounterColor string `yaml:"counterColor"` FilterColor string `yaml:"filterColor"` }
Title tracks title styles.
type View ¶
type View struct {
Active string `yaml:"active"`
}
View tracks view configuration options.