config

package
v0.25.20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 28, 2022 License: Apache-2.0, Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultC default concurrency.
	DefaultC = 1
	// DefaultN default number of requests.
	DefaultN = 200
	// DefaultMethod default http verb.
	DefaultMethod = "GET"
)
View Source
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 = ""
)
View Source
const (
	// DefaultDirMod default unix perms for k9s directory.
	DefaultDirMod os.FileMode = 0755
	// DefaultFileMod default unix perms for k9s files.
	DefaultFileMod os.FileMode = 0600
)
View Source
const (
	// DefaultLoggerTailCount tracks default log tail size.
	DefaultLoggerTailCount = 100
	// MaxLogThreshold sets the max value for log size.
	MaxLogThreshold = 5000
	// DefaultSinceSeconds tracks default log age.
	DefaultSinceSeconds = 60 // all logs
)
View Source
const DefaultPFAddress = "localhost"

DefaultPFAddress specifies the default PortForward host address.

View Source
const K9sConfig = "K9SCONFIG"

K9sConfig represents K9s configuration dir env var.

View Source
const (
	// MaxFavoritesNS number # favorite namespaces to keep in the configuration.
	MaxFavoritesNS = 9
)

Variables

View Source
var (
	// K9sConfigFile represents K9s config file location.
	K9sConfigFile = filepath.Join(K9sHome(), "config.yml")
	// K9sDefaultScreenDumpDir represents a default directory where K9s screen dumps will be persisted.
	K9sDefaultScreenDumpDir = filepath.Join(os.TempDir(), fmt.Sprintf("k9s-screens-%s", MustK9sUser()))
)
View Source
var DefaultLogFile = filepath.Join(os.TempDir(), fmt.Sprintf("k9s-%s.log", MustK9sUser()))

DefaultLogFile represents the default K9s log file.

View Source
var K9sAlias = filepath.Join(K9sHome(), "alias.yml")

K9sAlias manages K9s aliases.

View Source
var K9sBench = "bench"

K9sBench the name of the benchmarks config file.

View Source
var K9sHotKeys = filepath.Join(K9sHome(), "hotkey.yml")

K9sHotKeys manages K9s hotKeys.

View Source
var K9sPlugins = filepath.Join(K9sHome(), "plugin.yml")

K9sPlugins manages K9s plugins.

View Source
var K9sStylesFile = filepath.Join(K9sHome(), "skin.yml")

K9sStylesFile represents K9s skins file location.

View Source
var K9sViewConfigFile = filepath.Join(K9sHome(), "views.yml")

K9sViewConfigFile represents the location for the views configuration.

Functions

func EnsureFullPath added in v0.17.7

func EnsureFullPath(path string, mod os.FileMode)

EnsureFullPath ensures a directory exist from the given path.

func EnsurePath

func EnsurePath(path string, mod os.FileMode)

EnsurePath ensures a directory exist from the given path.

func InList

func InList(ll []string, n string) bool

InList check if string is in a collection of strings.

func InNSList

func InNSList(nn []interface{}, ns string) bool

InNSList check if ns is in an ns collection.

func IsBoolSet added in v0.24.9

func IsBoolSet(b *bool) bool

IsBoolSet checks if a bool prt is set.

func K9sHome

func K9sHome() string

K9sHome returns k9s configs home directory.

func MustK9sUser

func MustK9sUser() string

MustK9sUser establishes current user identity or fail.

Types

type Alias

type Alias map[string]string

Alias tracks shortname to GVR mappings.

type Aliases

type Aliases struct {
	Alias Alias `yaml:"alias"`
	// contains filtered or unexported fields
}

Aliases represents a collection of aliases.

func NewAliases

func NewAliases() *Aliases

NewAliases return a new alias.

func (*Aliases) Clear added in v0.13.8

func (a *Aliases) Clear()

Clear remove all aliases.

func (*Aliases) Define

func (a *Aliases) Define(gvr string, aliases ...string)

Define declares a new alias.

func (*Aliases) Get

func (a *Aliases) Get(k string) (string, bool)

Get retrieves an alias.

func (*Aliases) Keys added in v0.18.0

func (a *Aliases) Keys() []string

Keys returns all aliases keys.

func (*Aliases) Load

func (a *Aliases) Load() error

Load K9s aliases.

func (*Aliases) LoadFileAliases added in v0.16.0

func (a *Aliases) LoadFileAliases(path string) error

LoadFileAliases loads alias from a given file.

func (*Aliases) Save

func (a *Aliases) Save() error

Save alias to disk.

func (*Aliases) SaveAliases

func (a *Aliases) SaveAliases(path string) error

SaveAliases saves aliases to a given file.

func (*Aliases) ShortNames added in v0.13.8

func (a *Aliases) ShortNames() ShortNames

ShortNames return all shortnames.

type Auth

type Auth struct {
	User     string `yaml:"user"`
	Password string `yaml:"password"`
}

Auth basic auth creds.

type Bench

type Bench struct {
	Benchmarks *Benchmarks `yaml:"benchmarks"`
}

Bench tracks K9s styling options.

func NewBench

func NewBench(path string) (*Bench, error)

NewBench creates a new default config.

func (*Bench) Reload

func (s *Bench) Reload(path string) error

Reload update the configuration from disk.

type BenchConfig

type BenchConfig struct {
	Name string
	C    int  `yaml:"concurrency"`
	N    int  `yaml:"requests"`
	Auth Auth `yaml:"auth"`
	HTTP HTTP `yaml:"http"`
}

BenchConfig represents a service benchmark.

func DefaultBenchSpec added in v0.15.2

func DefaultBenchSpec() BenchConfig

DefaultBenchSpec returns a default bench spec.

type Benchmark

type Benchmark struct {
	C int `yaml:"concurrency"`
	N int `yaml:"requests"`
}

Benchmark represents a generic benchmark.

func (Benchmark) Empty added in v0.15.2

func (b Benchmark) Empty() bool

Empty checks if the benchmark is set.

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   Color `yaml:"fgColor"`
	BgColor   Color `yaml:"bgColor"`
	LogoColor Color `yaml:"logoColor"`
}

Body tracks body styles.

type Border

type Border struct {
	FgColor    Color `yaml:"fgColor"`
	FocusColor Color `yaml:"focusColor"`
}

Border tracks border styles.

type Charts added in v0.16.0

type Charts struct {
	BgColor            Color             `yaml:"bgColor"`
	DialBgColor        Color             `yaml:"dialBgColor"`
	ChartBgColor       Color             `yaml:"chartBgColor"`
	DefaultDialColors  Colors            `yaml:"defaultDialColors"`
	DefaultChartColors Colors            `yaml:"defaultChartColors"`
	ResourceColors     map[string]Colors `yaml:"resourceColors"`
}

Charts tracks charts styles.

type Cluster

type Cluster struct {
	Namespace          *Namespace    `yaml:"namespace"`
	View               *View         `yaml:"view"`
	FeatureGates       *FeatureGates `yaml:"featureGates"`
	ShellPod           *ShellPod     `yaml:"shellPod"`
	PortForwardAddress string        `yaml:"portForwardAddress"`
}

Cluster tracks K9s cluster configuration.

func NewCluster

func NewCluster() *Cluster

NewCluster creates a new cluster configuration.

func (*Cluster) Validate

func (c *Cluster) Validate(conn client.Connection, ks KubeSettings)

Validate a cluster config.

type Color added in v0.16.0

type Color string

Color represents a color.

const (
	// DefaultColor represents  a default color.
	DefaultColor Color = "default"

	// TransparentColor represents the terminal bg color.
	TransparentColor Color = "-"
)

func NewColor added in v0.16.0

func NewColor(c string) Color

NewColor returns a new color.

func (Color) Color added in v0.16.0

func (c Color) Color() tcell.Color

Color returns a view color.

func (Color) String added in v0.16.0

func (c Color) String() string

String returns color as string.

type Colors added in v0.16.0

type Colors []Color

Colors tracks multiple colors.

func (Colors) Colors added in v0.16.0

func (c Colors) Colors() []tcell.Color

Colors converts series string colors to colors.

type Config

type Config struct {
	K9s *K9s `yaml:"k9s"`
	// contains filtered or unexported fields
}

Config tracks K9s configuration options.

func NewConfig

func NewConfig(ks KubeSettings) *Config

NewConfig creates a new default config.

func (*Config) ActiveNamespace

func (c *Config) ActiveNamespace() string

ActiveNamespace returns the active namespace in the current cluster.

func (*Config) ActiveView

func (c *Config) ActiveView() string

ActiveView returns the active view in the current cluster.

func (*Config) CurrentCluster

func (c *Config) CurrentCluster() *Cluster

CurrentCluster fetch the configuration activeCluster.

func (*Config) Dump

func (c *Config) Dump(msg string)

Dump debug...

func (*Config) FavNamespaces

func (c *Config) FavNamespaces() []string

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) Load

func (c *Config) Load(path string) error

Load K9s configuration from file.

func (*Config) Refine

func (c *Config) Refine(flags *genericclioptions.ConfigFlags, k9sFlags *Flags, cfg *client.Config) 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) Save

func (c *Config) Save() error

Save configuration to disk.

func (*Config) SaveFile

func (c *Config) SaveFile(path string) error

SaveFile K9s configuration to disk.

func (*Config) SetActiveNamespace

func (c *Config) SetActiveNamespace(ns string) error

SetActiveNamespace set the active namespace in the current cluster.

func (*Config) SetActiveView

func (c *Config) SetActiveView(view string)

SetActiveView set the currently cluster active view.

func (*Config) SetConnection

func (c *Config) SetConnection(conn client.Connection)

SetConnection set an api server connection.

func (*Config) Validate

func (c *Config) Validate()

Validate the configuration.

func (*Config) ValidateFavorites added in v0.19.4

func (c *Config) ValidateFavorites()

ValidateFavorites ensure favorite ns are legit.

type Crumb

type Crumb struct {
	FgColor     Color `yaml:"fgColor"`
	BgColor     Color `yaml:"bgColor"`
	ActiveColor Color `yaml:"activeColor"`
}

Crumb tracks crumbs styles.

type CustomView added in v0.17.0

type CustomView struct {
	K9s ViewSettings `yaml:"k9s"`
	// contains filtered or unexported fields
}

CustomView represents a collection of view customization.

func NewCustomView added in v0.17.0

func NewCustomView() *CustomView

NewCustomView returns a views configuration.

func (*CustomView) AddListener added in v0.17.0

func (v *CustomView) AddListener(gvr string, l ViewConfigListener)

AddListener registers a new listener.

func (*CustomView) Load added in v0.17.0

func (v *CustomView) Load(path string) error

Load loads view configurations.

func (*CustomView) RemoveListener added in v0.17.0

func (v *CustomView) RemoveListener(gvr string)

RemoveListener unregister a listener.

func (*CustomView) Reset added in v0.17.0

func (v *CustomView) Reset()

Reset clears out configurations.

type Dialog added in v0.21.6

type Dialog struct {
	FgColor            Color `yaml:"fgColor"`
	BgColor            Color `yaml:"bgColor"`
	ButtonFgColor      Color `yaml:"buttonFgColor"`
	ButtonBgColor      Color `yaml:"buttonBgColor"`
	ButtonFocusFgColor Color `yaml:"buttonFocusFgColor"`
	ButtonFocusBgColor Color `yaml:"buttonFocusBgColor"`
	LabelFgColor       Color `yaml:"labelFgColor"`
	FieldFgColor       Color `yaml:"fieldFgColor"`
}

Dialog tracks dialog styles.

type FeatureGates added in v0.19.3

type FeatureGates struct {
	NodeShell bool `yaml:"nodeShell"`
}

FeatureGates represents K9s opt-in features.

func NewFeatureGates added in v0.19.3

func NewFeatureGates() *FeatureGates

NewFeatureGates returns a new feature gate.

type Flags

type Flags struct {
	RefreshRate   *int
	LogLevel      *string
	LogFile       *string
	Headless      *bool
	Logoless      *bool
	Command       *string
	AllNamespaces *bool
	ReadOnly      *bool
	Write         *bool
	Crumbsless    *bool
	ScreenDumpDir *string
}

Flags represents K9s configuration flags.

func NewFlags

func NewFlags() *Flags

NewFlags returns new 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 Help added in v0.24.9

type Help struct {
	FgColor      Color `yaml:"fgColor"`
	BgColor      Color `yaml:"bgColor"`
	SectionColor Color `yaml:"sectionColor"`
	KeyColor     Color `yaml:"keyColor"`
	NumKeyColor  Color `yaml:"numKeyColor"`
}

Help tracks help styles.

type HotKey

type HotKey struct {
	ShortCut    string `yaml:"shortCut"`
	Description string `yaml:"description"`
	Command     string `yaml:"command"`
}

HotKey describes a K9s hotkey.

type HotKeys

type HotKeys struct {
	HotKey map[string]HotKey `yaml:"hotKey"`
}

HotKeys represents a collection of plugins.

func NewHotKeys

func NewHotKeys() HotKeys

NewHotKeys returns a new plugin.

func (HotKeys) Load

func (h HotKeys) Load() error

Load K9s plugins.

func (HotKeys) LoadHotKeys

func (h HotKeys) LoadHotKeys(path string) error

LoadHotKeys loads plugins from a given file.

type Info

type Info struct {
	SectionColor Color `yaml:"sectionColor"`
	FgColor      Color `yaml:"fgColor"`
}

Info tracks info styles.

type K9s

type K9s struct {
	RefreshRate    int                 `yaml:"refreshRate"`
	MaxConnRetry   int                 `yaml:"maxConnRetry"`
	EnableMouse    bool                `yaml:"enableMouse"`
	Headless       bool                `yaml:"headless"`
	Logoless       bool                `yaml:"logoless"`
	Crumbsless     bool                `yaml:"crumbsless"`
	ReadOnly       bool                `yaml:"readOnly"`
	NoIcons        bool                `yaml:"noIcons"`
	Logger         *Logger             `yaml:"logger"`
	CurrentContext string              `yaml:"currentContext"`
	CurrentCluster string              `yaml:"currentCluster"`
	Clusters       map[string]*Cluster `yaml:"clusters,omitempty"`
	Thresholds     Threshold           `yaml:"thresholds"`
	ScreenDumpDir  string              `yaml:"screenDumpDir"`
	// contains filtered or unexported fields
}

K9s tracks K9s configuration options.

func NewK9s

func NewK9s() *K9s

NewK9s create a new K9s configuration.

func (*K9s) ActivateCluster added in v0.24.9

func (k *K9s) ActivateCluster(ns string)

ActivateCluster initializes the active cluster is not present.

func (*K9s) ActiveCluster

func (k *K9s) ActiveCluster() *Cluster

ActiveCluster returns the currently active cluster.

func (*K9s) GetRefreshRate

func (k *K9s) GetRefreshRate() int

GetRefreshRate returns the current refresh rate.

func (*K9s) GetScreenDumpDir added in v0.25.9

func (k *K9s) GetScreenDumpDir() string

func (*K9s) IsCrumbsless added in v0.23.0

func (k *K9s) IsCrumbsless() bool

IsCrumbsless returns crumbsless setting.

func (*K9s) IsHeadless added in v0.23.0

func (k *K9s) IsHeadless() bool

IsHeadless returns headless setting.

func (*K9s) IsLogoless added in v0.24.3

func (k *K9s) IsLogoless() bool

IsLogoless returns logoless setting.

func (*K9s) IsReadOnly added in v0.23.0

func (k *K9s) IsReadOnly() bool

IsReadOnly returns the readonly setting.

func (*K9s) OverrideCommand

func (k *K9s) OverrideCommand(cmd string)

OverrideCommand set the command manually.

func (*K9s) OverrideCrumbsless added in v0.23.0

func (k *K9s) OverrideCrumbsless(b bool)

OverrideCrumbsless tooh the crumbslessness manually.

func (*K9s) OverrideHeadless

func (k *K9s) OverrideHeadless(b bool)

OverrideHeadless toggle the header manually.

func (*K9s) OverrideLogoless added in v0.24.3

func (k *K9s) OverrideLogoless(b bool)

OverrideLogoless toggle the k9s logo manually.

func (*K9s) OverrideReadOnly added in v0.13.8

func (k *K9s) OverrideReadOnly(b bool)

OverrideReadOnly set the readonly mode manually.

func (*K9s) OverrideRefreshRate

func (k *K9s) OverrideRefreshRate(r int)

OverrideRefreshRate set the refresh rate manually.

func (*K9s) OverrideScreenDumpDir added in v0.25.9

func (k *K9s) OverrideScreenDumpDir(dir string)

OverrideScreenDumpDir set the screen dump dir manually.

func (*K9s) OverrideWrite added in v0.23.2

func (k *K9s) OverrideWrite(b bool)

OverrideWrite set the write mode 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() (map[string]struct{}, error)
}

KubeSettings exposes kubeconfig context information.

type Limits added in v0.19.5

type Limits map[v1.ResourceName]string

Limits represents resource limits.

type Log

type Log struct {
	FgColor   Color        `yaml:"fgColor"`
	BgColor   Color        `yaml:"bgColor"`
	Indicator LogIndicator `yaml:"indicator"`
}

Log tracks Log styles.

type LogIndicator added in v0.18.0

type LogIndicator struct {
	FgColor Color `yaml:"fgColor"`
	BgColor Color `yaml:"bgColor"`
}

LogIndicator tracks log view indicator.

type Logger added in v0.18.0

type Logger struct {
	TailCount      int64 `yaml:"tail"`
	BufferSize     int   `yaml:"buffer"`
	SinceSeconds   int64 `yaml:"sinceSeconds"`
	FullScreenLogs bool  `yaml:"fullScreenLogs"`
	TextWrap       bool  `yaml:"textWrap"`
	ShowTime       bool  `yaml:"showTime"`
}

Logger tracks logger options.

func NewLogger added in v0.18.0

func NewLogger() *Logger

NewLogger returns a new instance.

func (*Logger) Validate added in v0.18.0

func (l *Logger) Validate(_ client.Connection, _ KubeSettings)

Validate checks thresholds and make sure we're cool. If not use defaults.

type Menu struct {
	FgColor     Color `yaml:"fgColor"`
	KeyColor    Color `yaml:"keyColor"`
	NumKeyColor Color `yaml:"numKeyColor"`
}

Menu tracks menu styles.

type Namespace

type Namespace struct {
	Active        string   `yaml:"active"`
	LockFavorites bool     `yaml:"lockFavorites"`
	Favorites     []string `yaml:"favorites"`
}

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 {
	Scopes      []string `yaml:"scopes"`
	Args        []string `yaml:"args"`
	ShortCut    string   `yaml:"shortCut"`
	Pipes       []string `yaml:"pipes"`
	Description string   `yaml:"description"`
	Command     string   `yaml:"command"`
	Confirm     bool     `yaml:"confirm"`
	Background  bool     `yaml:"background"`
}

Plugin describes a K9s plugin.

func (Plugin) String added in v0.25.0

func (p Plugin) String() string

type Plugins

type Plugins struct {
	Plugin map[string]Plugin `yaml:"plugin"`
}

Plugins represents a collection of plugins.

func NewPlugins

func NewPlugins() Plugins

NewPlugins returns a new plugin.

func (Plugins) Load

func (p Plugins) Load() error

Load K9s plugins.

func (Plugins) LoadPlugins

func (p Plugins) LoadPlugins(path string) error

LoadPlugins loads plugins from a given file.

type Prompt added in v0.24.12

type Prompt struct {
	FgColor      Color `yaml:"fgColor"`
	BgColor      Color `yaml:"bgColor"`
	SuggestColor Color `yaml:"suggestColor"`
}

Prompt tracks command styles

type Severity added in v0.17.5

type Severity struct {
	Critical int `yaml:"critical"`
	Warn     int `yaml:"warn"`
}

Severity tracks a resource severity levels.

func NewSeverity added in v0.17.5

func NewSeverity() *Severity

NewSeverity returns a new instance.

func (*Severity) Validate added in v0.17.5

func (s *Severity) Validate()

Validate checks all thresholds and make sure we're cool. If not use defaults.

type SeverityLevel added in v0.17.5

type SeverityLevel int

SeverityLevel tracks severity levels.

const (
	// SeverityLow tracks low severity.
	SeverityLow SeverityLevel = iota

	// SeverityMedium tracks medium severity level.
	SeverityMedium

	// SeverityHigh tracks high severity level.
	SeverityHigh
)

type ShellPod added in v0.19.5

type ShellPod struct {
	Image     string   `json:"image"`
	Command   []string `json:"command,omitempty"`
	Args      []string `json:"args,omitempty"`
	Namespace string   `json:"namespace"`
	Limits    Limits   `json:"resources,omitempty"`
}

ShellPod represents k9s shell configuration.

func NewShellPod added in v0.19.5

func NewShellPod() *ShellPod

NewShellPod returns a new instance.

func (*ShellPod) Validate added in v0.19.5

func (s *ShellPod) Validate(client.Connection, KubeSettings)

Validate validates the configuration.

type ShortNames

type ShortNames map[string][]string

ShortNames represents a collection of shortnames for aliases.

type Status

type Status struct {
	NewColor       Color `yaml:"newColor"`
	ModifyColor    Color `yaml:"modifyColor"`
	AddColor       Color `yaml:"addColor"`
	PendingColor   Color `yaml:"pendingColor"`
	ErrorColor     Color `yaml:"errorColor"`
	HighlightColor Color `yaml:"highlightColor"`
	KillColor      Color `yaml:"killColor"`
	CompletedColor Color `yaml:"completedColor"`
}

Status tracks resource status styles.

type Style

type Style struct {
	Body   Body   `yaml:"body"`
	Prompt Prompt `yaml:"prompt"`
	Help   Help   `yaml:"help"`
	Frame  Frame  `yaml:"frame"`
	Info   Info   `yaml:"info"`
	Views  Views  `yaml:"views"`
	Dialog Dialog `yaml:"dialog"`
}

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 NewStyles

func NewStyles() *Styles

NewStyles creates a new default config.

func (*Styles) AddListener

func (s *Styles) AddListener(l StyleListener)

AddListener registers a new listener.

func (*Styles) BgColor

func (s *Styles) BgColor() tcell.Color

BgColor returns the background color.

func (*Styles) Body

func (s *Styles) Body() Body

Body returns body styles.

func (*Styles) Charts added in v0.16.0

func (s *Styles) Charts() Charts

Charts returns charts styles.

func (*Styles) Crumb

func (s *Styles) Crumb() Crumb

Crumb returns crumb styles.

func (*Styles) DefaultSkin added in v0.15.0

func (s *Styles) DefaultSkin()

DefaultSkin loads the default skin.

func (*Styles) Dialog added in v0.21.6

func (s *Styles) Dialog() Dialog

Dialog returns dialog styles.

func (*Styles) FgColor

func (s *Styles) FgColor() tcell.Color

FgColor returns the foreground color.

func (*Styles) Frame

func (s *Styles) Frame() Frame

Frame returns frame styles.

func (*Styles) Load

func (s *Styles) Load(path string) error

Load K9s configuration from file.

func (*Styles) RemoveListener

func (s *Styles) RemoveListener(l StyleListener)

RemoveListener removes a listener.

func (*Styles) Reset added in v0.16.0

func (s *Styles) Reset()

Reset resets styles.

func (*Styles) Table added in v0.13.3

func (s *Styles) Table() Table

Table returns table styles.

func (*Styles) Title

func (s *Styles) Title() Title

Title returns title styles.

func (*Styles) Update

func (s *Styles) Update()

Update apply terminal colors based on styles.

func (*Styles) Views

func (s *Styles) Views() Views

Views returns views styles.

func (*Styles) Xray added in v0.13.3

func (s *Styles) Xray() Xray

Xray returns xray styles.

type Table

type Table struct {
	FgColor       Color       `yaml:"fgColor"`
	BgColor       Color       `yaml:"bgColor"`
	CursorFgColor Color       `yaml:"cursorFgColor"`
	CursorBgColor Color       `yaml:"cursorBgColor"`
	MarkColor     Color       `yaml:"markColor"`
	Header        TableHeader `yaml:"header"`
}

Table tracks table styles.

type TableHeader

type TableHeader struct {
	FgColor     Color `yaml:"fgColor"`
	BgColor     Color `yaml:"bgColor"`
	SorterColor Color `yaml:"sorterColor"`
}

TableHeader tracks table header styles.

type Threshold added in v0.17.4

type Threshold map[string]*Severity

Threshold tracks threshold to alert user when excided.

func NewThreshold added in v0.17.5

func NewThreshold() Threshold

NewThreshold returns a new threshold.

func (Threshold) LevelFor added in v0.17.5

func (t Threshold) LevelFor(k string, v int) SeverityLevel

LevelFor returns a defcon level for the current state.

func (*Threshold) SeverityColor added in v0.17.5

func (t *Threshold) SeverityColor(k string, v int) string

SeverityColor returns an defcon level associated level.

func (Threshold) Validate added in v0.17.4

func (t Threshold) Validate(c client.Connection, ks KubeSettings)

Validate a namespace is setup correctly.

type Title

type Title struct {
	FgColor        Color `yaml:"fgColor"`
	BgColor        Color `yaml:"bgColor"`
	HighlightColor Color `yaml:"highlightColor"`
	CounterColor   Color `yaml:"counterColor"`
	FilterColor    Color `yaml:"filterColor"`
}

Title tracks title styles.

type View

type View struct {
	Active string `yaml:"active"`
}

View tracks view configuration options.

func NewView

func NewView() *View

NewView creates a new view configuration.

func (*View) Validate

func (v *View) Validate()

Validate a view configuration.

type ViewConfigListener added in v0.17.0

type ViewConfigListener interface {
	// ConfigChanged notifies listener the view configuration changed.
	ViewSettingsChanged(ViewSetting)
}

ViewConfigListener represents a view config listener.

type ViewSetting added in v0.17.0

type ViewSetting struct {
	Columns    []string `yaml:"columns"`
	SortColumn string   `yaml:"sortColumn"`
}

ViewSetting represents a view configuration.

type ViewSettings added in v0.17.0

type ViewSettings struct {
	Views map[string]ViewSetting `yaml:"views"`
}

ViewSettings represent a collection of view configurations.

func NewViewSettings added in v0.17.0

func NewViewSettings() ViewSettings

NewViewSettings returns a new configuration.

type Views

type Views struct {
	Table  Table  `yaml:"table"`
	Xray   Xray   `yaml:"xray"`
	Charts Charts `yaml:"charts"`
	Yaml   Yaml   `yaml:"yaml"`
	Log    Log    `yaml:"logs"`
}

Views tracks individual view styles.

type Xray added in v0.13.3

type Xray struct {
	FgColor         Color `yaml:"fgColor"`
	BgColor         Color `yaml:"bgColor"`
	CursorColor     Color `yaml:"cursorColor"`
	CursorTextColor Color `yaml:"cursorTextColor"`
	GraphicColor    Color `yaml:"graphicColor"`
}

Xray tracks xray styles.

type Yaml

type Yaml struct {
	KeyColor   Color `yaml:"keyColor"`
	ValueColor Color `yaml:"valueColor"`
	ColonColor Color `yaml:"colonColor"`
}

Yaml tracks yaml styles.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL