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 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() 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 Connection)
- func (c *Config) Validate()
- type Connection
- type Crumb
- type Flags
- type Frame
- type HTTP
- type Info
- type K9s
- type KubeSettings
- type Log
- type Menu
- type Namespace
- type Plugin
- type Status
- type Style
- type Styles
- type Table
- type TableHeader
- type Title
- type View
- type Views
- 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 = "po" )
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 = 10
)
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 (
// K9sBench the name of the benchmarks config file.
K9sBench = "bench"
)
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 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 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() 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 Connection)
SetConnection set an api server connection.
type Connection ¶
type Connection k8s.Connection
Connection present a kubernetes 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 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 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"` Clusters map[string]*Cluster `yaml:"clusters,omitempty"` Plugins map[string]*Plugin `yaml:"plugins,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 k8s.Connection, ks KubeSettings)
Validate the current configuration.
type KubeSettings ¶
type KubeSettings interface { CurrentContextName() (string, error) CurrentClusterName() (string, error) CurrentNamespaceName() (string, error) ClusterNames() ([]string, error) NamespaceNames(nn []v1.Namespace) []string }
KubeSettings exposes kubeconfig context informations.
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 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 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"` Views Views `yaml:"views"` }
Style tracks K9s styles.
type Styles ¶
type Styles struct {
K9s Style `yaml:"k9s"`
}
Styles tracks K9s styling options.
type Table ¶
type Table struct { FgColor string `yaml:"fgColor"` BgColor string `yaml:"bgColor"` CursorColor string `yaml:"cursorColor"` 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.