Documentation ¶
Index ¶
Constants ¶
View Source
const ( // DefaultDirMod default unix perms for k9s directory. DefaultDirMod os.FileMode = 0744 // DefaultFileMod default unix perms for k9s files. DefaultFileMod os.FileMode = 0600 // MainConfigFile track main configuration file.. MainConfigFile = "config.yaml" )
View Source
const DefaultPFAddress = "localhost"
DefaultPFAddress specifies the default PortForward host address.
View Source
const DefaultView = "po"
View Source
const (
// MaxFavoritesNS number # favorite namespaces to keep in the configuration.
MaxFavoritesNS = 9
)
Variables ¶
This section is empty.
Functions ¶
func EnsureDirPath ¶
EnsureDirPath ensures a directory exist from the given path.
func EnsureFullPath ¶
EnsureFullPath ensures a directory exist from the given path.
Types ¶
type Config ¶
type Config struct {
Context *Context `yaml:"k9s"`
}
Config tracks a context configuration.
func (*Config) Validate ¶
func (c *Config) Validate(conn client.Connection, ks KubeSettings)
type Context ¶
type Context struct { ClusterName string `yaml:"cluster,omitempty"` ReadOnly bool `yaml:"readOnly"` Skin string `yaml:"skin,omitempty"` Namespace *Namespace `yaml:"namespace"` View *View `yaml:"view"` FeatureGates FeatureGates `yaml:"featureGates"` PortForwardAddress string `yaml:"portForwardAddress"` }
Context tracks K9s context configuration.
func NewContextFromConfig ¶
func (*Context) Validate ¶
func (c *Context) Validate(conn client.Connection, ks KubeSettings)
Validate a context config.
type Dir ¶
type Dir struct {
// contains filtered or unexported fields
}
func NewDir ¶
func NewDir(root string, conn client.Connection, ks KubeSettings) *Dir
type FeatureGates ¶
type FeatureGates struct {
NodeShell bool `yaml:"nodeShell"`
}
FeatureGates represents K9s opt-in features.
func NewFeatureGates ¶
func NewFeatureGates() FeatureGates
NewFeatureGates returns a new feature gate.
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) // ContextNames() returns all available context names. ContextNames() (map[string]struct{}, error) // CurrentContext returns the current context configuration. CurrentContext() (*api.Context, error) // GetContext returns a given context configuration or err if not found. GetContext(string) (*api.Context, error) }
KubeSettings exposes kubeconfig context information.
type Namespace ¶
type Namespace struct { Active string `yaml:"active"` LockFavorites bool `yaml:"lockFavorites"` Favorites []string `yaml:"favorites"` }
Namespace tracks active and favorites namespaces.
func NewActiveNamespace ¶
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.
Click to show internal directories.
Click to hide internal directories.