config

package
v0.32.4 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: Apache-2.0, Apache-2.0 Imports: 20 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 (
	// K9sEnvConfigDir represents k9s configuration dir env var.
	K9sEnvConfigDir = "K9S_CONFIG_DIR"

	// K9sEnvLogsDir represents k9s logs dir env var.
	K9sEnvLogsDir = "K9S_LOGS_DIR"

	// AppName tracks k9s app name.
	AppName = "k9s"

	K9sLogsFile = "k9s.log"
)
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 (
	// DefaultLoggerTailCount tracks default log tail size.
	DefaultLoggerTailCount = 100

	// MaxLogThreshold sets the max value for log size.
	MaxLogThreshold = 5000

	// DefaultSinceSeconds tracks default log age.
	DefaultSinceSeconds = -1 // tail logs by default
)

Variables

View Source
var (
	// AppConfigDir tracks main k9s config home directory.
	AppConfigDir string

	// AppSkinsDir tracks skins data directory.
	AppSkinsDir string

	// AppBenchmarksDir tracks benchmarks results directory.
	AppBenchmarksDir string

	// AppDumpsDir tracks screen dumps data directory.
	AppDumpsDir string

	// AppContextsDir tracks contexts data directory.
	AppContextsDir string

	// AppConfigFile tracks k9s config file.
	AppConfigFile string

	// AppLogFile tracks k9s logs file.
	AppLogFile string

	// AppViewsFile tracks custom views config file.
	AppViewsFile string

	// AppAliasesFile tracks aliases config file.
	AppAliasesFile string

	// AppPluginsFile tracks plugins config file.
	AppPluginsFile string

	// AppHotKeysFile tracks hotkeys config file.
	AppHotKeysFile string
)
View Source
var K9sBench = "bench"

K9sBench the name of the benchmarks config file.

Functions

func AppContextAliasesFile added in v0.30.0

func AppContextAliasesFile(cluster, context string) string

AppContextAliasesFile generates a valid context specific aliases file path.

func AppContextConfig added in v0.30.0

func AppContextConfig(cluster, context string) string

AppContextConfig generates a valid context config file path.

func AppContextDir added in v0.30.0

func AppContextDir(cluster, context string) string

AppContextDir generates a valid context config dir.

func AppContextHotkeysFile added in v0.30.0

func AppContextHotkeysFile(cluster, context string) string

AppContextHotkeysFile generates a valid context specific hotkeys file path.

func AppContextPluginsFile added in v0.30.0

func AppContextPluginsFile(cluster, context string) string

AppContextPluginsFile generates a valid context specific plugins file path.

func DumpsDir added in v0.30.0

func DumpsDir(cluster, context string) (string, error)

DumpsDir generates a valid context dump directory.

func EnsureAliasesCfgFile added in v0.30.0

func EnsureAliasesCfgFile() (string, error)

EnsureAliasesCfgFile generates a valid aliases file.

func EnsureBenchmarksCfgFile added in v0.30.0

func EnsureBenchmarksCfgFile(cluster, context string) (string, error)

EnsureBenchmarksCfgFile generates a valid benchmark file.

func EnsureBenchmarksDir added in v0.30.0

func EnsureBenchmarksDir(cluster, context string) (string, error)

EnsureBenchmarksDir generates a valid benchmark results directory.

func EnsureHotkeysCfgFile added in v0.30.0

func EnsureHotkeysCfgFile() (string, error)

EnsureHotkeysCfgFile generates a valid hotkeys file.

func InNSList

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

InNSList check if ns is in an ns collection.

func InitLocs added in v0.30.0

func InitLocs() error

InitLocs initializes k9s artifacts locations.

func InitLogLoc added in v0.30.0

func InitLogLoc() error

InitLogLoc initializes K9s logs location.

func IsBoolSet added in v0.24.9

func IsBoolSet(b *bool) bool

IsBoolSet checks if a bool prt is set.

func MustK9sUser

func MustK9sUser() string

MustK9sUser establishes current user identity or fail.

func SkinFileFromName added in v0.30.0

func SkinFileFromName(n string) string

SkinFileFromName generate skin file path from spec.

func UserTmpDir added in v0.30.5

func UserTmpDir() (string, error)

UserTmpDir returns the temp dir with the current user name.

Types

type Alias

type Alias map[string]string

Alias tracks shortname to GVR mappings.

type Aliases

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

Aliases represents a collection of aliases.

func NewAliases

func NewAliases() *Aliases

NewAliases return a new alias.

func (*Aliases) AliasesFor added in v0.31.9

func (a *Aliases) AliasesFor(s string) []string

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(path string) error

Load K9s aliases.

func (*Aliases) LoadFile added in v0.30.0

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

LoadFile 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 `json:"fgColor" yaml:"fgColor"`
	BgColor        Color `json:"bgColor" yaml:"bgColor"`
	LogoColor      Color `json:"logoColor" yaml:"logoColor"`
	LogoColorMsg   Color `json:"logoColorMsg" yaml:"logoColorMsg"`
	LogoColorInfo  Color `json:"logoColorInfo" yaml:"logoColorInfo"`
	LogoColorWarn  Color `json:"logoColorWarn" yaml:"logoColorWarn"`
	LogoColorError Color `json:"logoColorError" yaml:"logoColorError"`
}

Body tracks body styles.

type Border

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

Border tracks border styles.

type Charts added in v0.16.0

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

Charts tracks charts styles.

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" json:"k9s"`
	// contains filtered or unexported fields
}

Config tracks K9s configuration options.

func NewConfig

func NewConfig(ks data.KubeSettings) *Config

NewConfig creates a new default config.

func (*Config) ActiveContextName added in v0.30.0

func (c *Config) ActiveContextName() string

func (*Config) ActiveNamespace

func (c *Config) ActiveNamespace() string

ActiveNamespace returns the active namespace in the current context. If none found return the empty ns.

func (*Config) ActiveView

func (c *Config) ActiveView() string

ActiveView returns the active view in the current context.

func (*Config) ContextAliasesPath added in v0.30.0

func (c *Config) ContextAliasesPath() string

ContextAliasesPath returns a context specific aliases file spec.

func (*Config) ContextHotkeysPath added in v0.31.0

func (c *Config) ContextHotkeysPath() string

ContextHotkeysPath returns a context specific hotkeys file spec.

func (*Config) ContextPluginsPath added in v0.30.0

func (c *Config) ContextPluginsPath() (string, error)

ContextPluginsPath returns a context specific plugins file spec.

func (*Config) CurrentContext added in v0.30.0

func (c *Config) CurrentContext() (*data.Context, error)

CurrentContext fetch the configuration active context.

func (*Config) Dump

func (c *Config) Dump(msg string)

Dump for debug...

func (*Config) FavNamespaces

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

FavNamespaces returns fav namespaces in the current context.

func (*Config) GetConnection

func (c *Config) GetConnection() client.Connection

GetConnection return an api server connection.

func (*Config) Load

func (c *Config) Load(path string, force bool) error

Load loads K9s configuration from file.

func (*Config) Merge added in v0.31.0

func (c *Config) Merge(c1 *Config)

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 resets the context to the new current context/cluster.

func (*Config) Save

func (c *Config) Save(force bool) 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 context.

func (*Config) SetActiveView

func (c *Config) SetActiveView(view string)

SetActiveView sets current context active view.

func (*Config) SetConnection

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

SetConnection set an api server connection.

func (*Config) SetCurrentContext added in v0.30.0

func (c *Config) SetCurrentContext(n string) (*data.Context, error)

func (*Config) Validate

func (c *Config) Validate()

Validate the configuration.

type Crumb

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

Crumb tracks crumbs styles.

type CustomView added in v0.17.0

type CustomView struct {
	Views map[string]ViewSetting `yaml:"views"`
	// 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 `json:"fgColor" yaml:"fgColor"`
	BgColor            Color `json:"bgColor" yaml:"bgColor"`
	ButtonFgColor      Color `json:"buttonFgColor" yaml:"buttonFgColor"`
	ButtonBgColor      Color `json:"buttonBgColor" yaml:"buttonBgColor"`
	ButtonFocusFgColor Color `json:"buttonFocusFgColor" yaml:"buttonFocusFgColor"`
	ButtonFocusBgColor Color `json:"buttonFocusBgColor" yaml:"buttonFocusBgColor"`
	LabelFgColor       Color `json:"labelFgColor" yaml:"labelFgColor"`
	FieldFgColor       Color `json:"fieldFgColor" yaml:"fieldFgColor"`
}

Dialog tracks dialog styles.

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  `json:"title" yaml:"title"`
	Border Border `json:"border" yaml:"border"`
	Menu   Menu   `json:"menu" yaml:"menu"`
	Crumb  Crumb  `json:"crumbs" yaml:"crumbs"`
	Status Status `json:"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 `json:"fgColor" yaml:"fgColor"`
	BgColor      Color `json:"bgColor" yaml:"bgColor"`
	SectionColor Color `json:"sectionColor" yaml:"sectionColor"`
	KeyColor     Color `json:"keyColor" yaml:"keyColor"`
	NumKeyColor  Color `json:"numKeyColor" yaml:"numKeyColor"`
}

Help tracks help styles.

type HotKey

type HotKey struct {
	ShortCut    string `yaml:"shortCut"`
	Override    bool   `yaml:"override"`
	Description string `yaml:"description"`
	Command     string `yaml:"command"`
	KeepHistory bool   `yaml:"keepHistory"`
}

HotKey describes a K9s hotkey.

type HotKeys

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

HotKeys represents a collection of plugins.

func NewHotKeys

func NewHotKeys() HotKeys

NewHotKeys returns a new plugin.

func (HotKeys) Load

func (h HotKeys) Load(path string) error

Load K9s plugins.

func (HotKeys) LoadHotKeys

func (h HotKeys) LoadHotKeys(path string) error

LoadHotKeys loads plugins from a given file.

type ImageScans added in v0.30.0

type ImageScans struct {
	Enable     bool         `json:"enable" yaml:"enable"`
	Exclusions ScanExcludes `json:"exclusions" yaml:"exclusions"`
}

ImageScans tracks vul scans options.

func NewImageScans added in v0.30.0

func NewImageScans() ImageScans

NewImageScans returns a new instance.

func (ImageScans) ShouldExclude added in v0.30.0

func (i ImageScans) ShouldExclude(ns string, ll map[string]string) bool

ShouldExclude checks if scan should be excluder given ns/labels

type Info

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

Info tracks info styles.

type K9s

type K9s struct {
	LiveViewAutoRefresh bool       `json:"liveViewAutoRefresh" yaml:"liveViewAutoRefresh"`
	ScreenDumpDir       string     `json:"screenDumpDir" yaml:"screenDumpDir,omitempty"`
	RefreshRate         int        `json:"refreshRate" yaml:"refreshRate"`
	MaxConnRetry        int        `json:"maxConnRetry" yaml:"maxConnRetry"`
	ReadOnly            bool       `json:"readOnly" yaml:"readOnly"`
	NoExitOnCtrlC       bool       `json:"noExitOnCtrlC" yaml:"noExitOnCtrlC"`
	UI                  UI         `json:"ui" yaml:"ui"`
	SkipLatestRevCheck  bool       `json:"skipLatestRevCheck" yaml:"skipLatestRevCheck"`
	DisablePodCounting  bool       `json:"disablePodCounting" yaml:"disablePodCounting"`
	ShellPod            ShellPod   `json:"shellPod" yaml:"shellPod"`
	ImageScans          ImageScans `json:"imageScans" yaml:"imageScans"`
	Logger              Logger     `json:"logger" yaml:"logger"`
	Thresholds          Threshold  `json:"thresholds" yaml:"thresholds"`
	// contains filtered or unexported fields
}

K9s tracks K9s configuration options.

func NewK9s

func NewK9s(conn client.Connection, ks data.KubeSettings) *K9s

NewK9s create a new K9s configuration.

func (*K9s) ActivateContext added in v0.30.0

func (k *K9s) ActivateContext(n string) (*data.Context, error)

ActivateContext initializes the active context if not present.

func (*K9s) ActiveContext added in v0.30.0

func (k *K9s) ActiveContext() (*data.Context, error)

ActiveContext returns the currently active context.

func (*K9s) ActiveContextName added in v0.30.0

func (k *K9s) ActiveContextName() string

ActiveContextName returns the active context name.

func (*K9s) ActiveContextNamespace added in v0.30.0

func (k *K9s) ActiveContextNamespace() (string, error)

ActiveContextNamespace fetch the context active ns.

func (*K9s) AppScreenDumpDir added in v0.31.0

func (k *K9s) AppScreenDumpDir() string

AppScreenDumpDir fetch screen dumps dir.

func (*K9s) ContextScreenDumpDir added in v0.31.0

func (k *K9s) ContextScreenDumpDir() string

ContextScreenDumpDir fetch context specific screen dumps dir.

func (*K9s) GetRefreshRate

func (k *K9s) GetRefreshRate() int

GetRefreshRate returns the current refresh rate.

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) Merge added in v0.31.0

func (k *K9s) Merge(k1 *K9s)

Merge merges k9s configs.

func (*K9s) Override added in v0.30.2

func (k *K9s) Override(k9sFlags *Flags)

Override overrides k9s config from cli args.

func (*K9s) Reload added in v0.30.7

func (k *K9s) Reload() error

Reload reloads the context config from disk.

func (*K9s) Reset added in v0.30.0

func (k *K9s) Reset()

Reset resets configuration and context.

func (*K9s) Save added in v0.30.0

func (k *K9s) Save(force bool) error

Save saves the k9s config to disk.

func (*K9s) Validate

func (k *K9s) Validate(c client.Connection, ks data.KubeSettings)

Validate the current configuration.

type Labels added in v0.30.0

type Labels map[string][]string

Labels tracks a collection of labels.

type Limits added in v0.19.5

type Limits map[v1.ResourceName]string

Limits represents resource limits.

type Log

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

Log tracks Log styles.

type LogIndicator added in v0.18.0

type LogIndicator struct {
	FgColor        Color `json:"fgColor" yaml:"fgColor"`
	BgColor        Color `json:"bgColor" yaml:"bgColor"`
	ToggleOnColor  Color `json:"toggleOnColor" yaml:"toggleOnColor"`
	ToggleOffColor Color `json:"toggleOffColor" yaml:"toggleOffColor"`
}

LogIndicator tracks log view indicator.

type Logger added in v0.18.0

type Logger struct {
	TailCount    int64 `json:"tail" yaml:"tail"`
	BufferSize   int   `json:"buffer" yaml:"buffer"`
	SinceSeconds int64 `json:"sinceSeconds" yaml:"sinceSeconds"`
	TextWrap     bool  `json:"textWrap" yaml:"textWrap"`
	ShowTime     bool  `json:"showTime" 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() Logger

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

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

Menu tracks menu styles.

type Picker added in v0.29.0

type Picker struct {
	MainColor     Color `json:"mainColor" yaml:"mainColor"`
	FocusColor    Color `json:"focusColor" yaml:"focusColor"`
	ShortcutColor Color `json:"shortcutColor" yaml:"shortcutColor"`
}

Picker tracks color when selecting containers

type Plugin

type Plugin struct {
	Scopes      []string `yaml:"scopes"`
	Args        []string `yaml:"args"`
	ShortCut    string   `yaml:"shortCut"`
	Override    bool     `yaml:"override"`
	Pipes       []string `yaml:"pipes"`
	Description string   `yaml:"description"`
	Command     string   `yaml:"command"`
	Confirm     bool     `yaml:"confirm"`
	Background  bool     `yaml:"background"`
	Dangerous   bool     `yaml:"dangerous"`
}

Plugin describes a K9s plugin.

func (Plugin) String added in v0.25.0

func (p Plugin) String() string

type Plugins

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

Plugins represents a collection of plugins.

func NewPlugins

func NewPlugins() Plugins

NewPlugins returns a new plugin.

func (Plugins) Load

func (p Plugins) Load(path string) error

Load K9s plugins.

type Prompt added in v0.24.12

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

Prompt tracks command styles

type PromptBorder added in v0.28.1

type PromptBorder struct {
	CommandColor Color `json:"command" yaml:"command"`
	DefaultColor Color `json:"default" yaml:"default"`
}

PromptBorder tracks the color of the prompt depending on its kind (e.g., command or filter)

type ScanExcludes added in v0.30.2

type ScanExcludes struct {
	Namespaces []string `json:"namespaces" yaml:"namespaces"`
	Labels     Labels   `json:"labels" yaml:"labels"`
}

ScanExcludes tracks vul scan exclusions.

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" yaml:"image"`
	Command          []string                  `json:"command,omitempty" yaml:"command,omitempty"`
	Args             []string                  `json:"args,omitempty" yaml:"args,omitempty"`
	Namespace        string                    `json:"namespace" yaml:"namespace"`
	Limits           Limits                    `json:"limits,omitempty" yaml:"limits,omitempty"`
	Labels           map[string]string         `json:"labels,omitempty" yaml:"labels,omitempty"`
	ImagePullSecrets []v1.LocalObjectReference `json:"imagePullSecrets,omitempty" yaml:"imagePullSecrets,omitempty"`
	ImagePullPolicy  v1.PullPolicy             `json:"imagePullPolicy,omitempty" yaml:"imagePullPolicy,omitempty"`
	TTY              bool                      `json:"tty,omitempty" yaml:"tty,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() ShellPod

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 `json:"newColor" yaml:"newColor"`
	ModifyColor    Color `json:"modifyColor" yaml:"modifyColor"`
	AddColor       Color `json:"addColor" yaml:"addColor"`
	PendingColor   Color `json:"pendingColor" yaml:"pendingColor"`
	ErrorColor     Color `json:"errorColor" yaml:"errorColor"`
	HighlightColor Color `json:"highlightColor" yaml:"highlightColor"`
	KillColor      Color `json:"killColor" yaml:"killColor"`
	CompletedColor Color `json:"completedColor" yaml:"completedColor"`
}

Status tracks resource status styles.

type Style

type Style struct {
	Body   Body   `json:"body" yaml:"body"`
	Prompt Prompt `json:"prompt" yaml:"prompt"`
	Help   Help   `json:"help" yaml:"help"`
	Frame  Frame  `json:"frame" yaml:"frame"`
	Info   Info   `json:"info" yaml:"info"`
	Views  Views  `json:"views" yaml:"views"`
	Dialog Dialog `json:"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 `json:"k9s" 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) Dialog added in v0.21.6

func (s *Styles) Dialog() Dialog

Dialog returns dialog styles.

func (*Styles) Dump added in v0.31.0

func (s *Styles) Dump()

Dump for debug.

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) Prompt added in v0.28.1

func (s *Styles) Prompt() Prompt

Prompt returns prompt styles.

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       `json:"fgColor" yaml:"fgColor"`
	BgColor       Color       `json:"bgColor" yaml:"bgColor"`
	CursorFgColor Color       `json:"cursorFgColor" yaml:"cursorFgColor"`
	CursorBgColor Color       `json:"cursorBgColor" yaml:"cursorBgColor"`
	MarkColor     Color       `json:"markColor" yaml:"markColor"`
	Header        TableHeader `json:"header" yaml:"header"`
}

Table tracks table styles.

type TableHeader

type TableHeader struct {
	FgColor     Color `json:"fgColor" yaml:"fgColor"`
	BgColor     Color `json:"bgColor" yaml:"bgColor"`
	SorterColor Color `json:"sorterColor" 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() Threshold

Validate a namespace is setup correctly.

type Title

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

Title tracks title styles.

type UI added in v0.30.0

type UI struct {
	// EnableMouse toggles mouse support.
	EnableMouse bool `json:"enableMouse" yaml:"enableMouse"`

	// Headless toggles top header display.
	Headless bool `json:"headless" yaml:"headless"`

	// LogoLess toggles k9s logo.
	Logoless bool `json:"logoless" yaml:"logoless"`

	// Crumbsless toggles nav crumb display.
	Crumbsless bool `json:"crumbsless" yaml:"crumbsless"`

	// Reactive toggles reactive ui changes.
	Reactive bool `json:"reactive" yaml:"reactive"`

	// NoIcons toggles icons display.
	NoIcons bool `json:"noIcons" yaml:"noIcons"`

	// Skin reference the general k9s skin name.
	// Can be overridden per context.
	Skin string `json:"skin" yaml:"skin,omitempty"`

	// DefaultsToFullScreen toggles fullscreen on views like logs, yaml, details.
	DefaultsToFullScreen bool `json:"defaultsToFullScreen" yaml:"defaultsToFullScreen"`
}

UI tracks ui specific configs.

type ViewConfigListener added in v0.17.0

type ViewConfigListener interface {
	// ViewSettingsChanged 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.

func (*ViewSetting) HasCols added in v0.32.0

func (v *ViewSetting) HasCols() bool

func (*ViewSetting) IsBlank added in v0.32.0

func (v *ViewSetting) IsBlank() bool

func (*ViewSetting) SortCol added in v0.32.0

func (v *ViewSetting) SortCol() (string, bool, error)

type Views

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

Views tracks individual view styles.

type Xray added in v0.13.3

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

Xray tracks xray styles.

type Yaml

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

Yaml tracks yaml styles.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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