config

package
v0.0.0-...-ecac4c4 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: Apache-2.0, Apache-2.0 Imports: 23 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

func AppContextAliasesFile(cluster, context string) string

AppContextAliasesFile generates a valid context specific aliases file path.

func AppContextConfig

func AppContextConfig(cluster, context string) string

AppContextConfig generates a valid context config file path.

func AppContextDir

func AppContextDir(cluster, context string) string

AppContextDir generates a valid context config dir.

func AppContextHotkeysFile

func AppContextHotkeysFile(cluster, context string) string

AppContextHotkeysFile generates a valid context specific hotkeys file path.

func AppContextPluginsFile

func AppContextPluginsFile(cluster, context string) string

AppContextPluginsFile generates a valid context specific plugins file path.

func DumpsDir

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

DumpsDir generates a valid context dump directory.

func EnsureAliasesCfgFile

func EnsureAliasesCfgFile() (string, error)

EnsureAliasesCfgFile generates a valid aliases file.

func EnsureBenchmarksCfgFile

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

EnsureBenchmarksCfgFile generates a valid benchmark file.

func EnsureBenchmarksDir

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

EnsureBenchmarksDir generates a valid benchmark results directory.

func EnsureHotkeysCfgFile

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

func InitLocs() error

InitLocs initializes k9s artifacts locations.

func InitLogLoc

func InitLogLoc() error

InitLogLoc initializes K9s logs location.

func IsBoolSet

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

func SkinFileFromName(n string) string

SkinFileFromName generate skin file path from spec.

func UserTmpDir

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

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

func (*Aliases) Clear

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

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

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

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

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

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

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

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

func NewColor(c string) Color

NewColor returns a new color.

func (Color) Color

func (c Color) Color() tcell.Color

Color returns a view color.

func (Color) String

func (c Color) String() string

String returns color as string.

type Colors

type Colors []Color

Colors tracks multiple colors.

func (Colors) Colors

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

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

func (c *Config) ContextAliasesPath() string

ContextAliasesPath returns a context specific aliases file spec.

func (*Config) ContextHotkeysPath

func (c *Config) ContextHotkeysPath() string

ContextHotkeysPath returns a context specific hotkeys file spec.

func (*Config) ContextPluginsPath

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

ContextPluginsPath returns a context specific plugins file spec.

func (*Config) CurrentContext

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

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

func (c *Config) ResetActiveView()

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

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

type CustomView struct {
	Views map[string]ViewSetting `yaml:"views"`
	// contains filtered or unexported fields
}

CustomView represents a collection of view customization.

func NewCustomView

func NewCustomView() *CustomView

NewCustomView returns a views configuration.

func (*CustomView) AddListener

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

AddListener registers a new listener.

func (*CustomView) Load

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

Load loads view configurations.

func (*CustomView) RemoveListener

func (v *CustomView) RemoveListener(gvr string)

RemoveListener unregister a listener.

func (*CustomView) Reset

func (v *CustomView) Reset()

Reset clears out configurations.

type Dialog

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

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

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

ImageScans tracks vul scans options.

func NewImageScans

func NewImageScans() ImageScans

NewImageScans returns a new instance.

func (ImageScans) ShouldExclude

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

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

ActivateContext initializes the active context if not present.

func (*K9s) ActiveContext

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

ActiveContext returns the currently active context.

func (*K9s) ActiveContextName

func (k *K9s) ActiveContextName() string

ActiveContextName returns the active context name.

func (*K9s) ActiveContextNamespace

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

ActiveContextNamespace fetch the context active ns.

func (*K9s) AppScreenDumpDir

func (k *K9s) AppScreenDumpDir() string

AppScreenDumpDir fetch screen dumps dir.

func (*K9s) ContextScreenDumpDir

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

func (k *K9s) IsCrumbsless() bool

IsCrumbsless returns crumbsless setting.

func (*K9s) IsHeadless

func (k *K9s) IsHeadless() bool

IsHeadless returns headless setting.

func (*K9s) IsLogoless

func (k *K9s) IsLogoless() bool

IsLogoless returns logoless setting.

func (*K9s) IsReadOnly

func (k *K9s) IsReadOnly() bool

IsReadOnly returns the readonly setting.

func (*K9s) Merge

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

Merge merges k9s configs.

func (*K9s) Override

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

Override overrides k9s config from cli args.

func (*K9s) Reload

func (k *K9s) Reload() error

Reload reloads the context config from disk.

func (*K9s) Reset

func (k *K9s) Reset()

Reset resets configuration and context.

func (*K9s) Save

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

type Labels map[string][]string

Labels tracks a collection of labels.

type Limits

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

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

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

func NewLogger() Logger

NewLogger returns a new instance.

func (Logger) Validate

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

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"`
	OverwriteOutput bool     `yaml:"overwriteOutput"`
}

Plugin describes a K9s plugin.

func (Plugin) String

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

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

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

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

ScanExcludes tracks vul scan exclusions.

type Severity

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

Severity tracks a resource severity levels.

func NewSeverity

func NewSeverity() *Severity

NewSeverity returns a new instance.

func (*Severity) Validate

func (s *Severity) Validate()

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

type SeverityLevel

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

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

func NewShellPod() ShellPod

NewShellPod returns a new instance.

func (ShellPod) Validate

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

func (s *Styles) Charts() Charts

Charts returns charts styles.

func (*Styles) Crumb

func (s *Styles) Crumb() Crumb

Crumb returns crumb styles.

func (*Styles) Dialog

func (s *Styles) Dialog() Dialog

Dialog returns dialog styles.

func (*Styles) Dump

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

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

func (s *Styles) Reset()

Reset resets styles.

func (*Styles) Table

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

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

type Threshold map[string]*Severity

Threshold tracks threshold to alert user when excided.

func NewThreshold

func NewThreshold() Threshold

NewThreshold returns a new threshold.

func (Threshold) LevelFor

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

LevelFor returns a defcon level for the current state.

func (*Threshold) SeverityColor

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

SeverityColor returns an defcon level associated level.

func (Threshold) Validate

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

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

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

ViewConfigListener represents a view config listener.

type ViewSetting

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

ViewSetting represents a view configuration.

func (*ViewSetting) Equals

func (v *ViewSetting) Equals(vs *ViewSetting) bool

func (*ViewSetting) HasCols

func (v *ViewSetting) HasCols() bool

func (*ViewSetting) IsBlank

func (v *ViewSetting) IsBlank() bool

func (*ViewSetting) SortCol

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

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