Documentation
¶
Overview ¶
Package config loads the optional kubeside config file.
Zero-config is the first run: kubeside infers environments from context names and never writes what it inferred. A file exists only because the user made one, and this package only ever reads it.
Two rules shape everything here. A shared file identifies clusters by API server URL, because context names are personal: one teammate's "prod-us-east" is another's EKS ARN. And anything the file gets wrong is an error that names the offending value, never a silent fallback. A misspelled key that quietly does nothing would leave a developer believing prod is guarded when it is not.
Index ¶
Constants ¶
const EnvVar = "KUBESIDE_CONFIG"
EnvVar points at a shared config file, typically one a team commits.
Variables ¶
This section is empty.
Functions ¶
func NormalizeURL ¶ added in v1.2.0
NormalizeURL makes server URLs comparable across the small differences that mean nothing: a trailing slash, or a host written in a different case.
Types ¶
type Config ¶
type Config struct {
// Path is where it came from, empty when no file exists.
Path string
// Environments are the configured ones, in the order written, so the UI can
// list them the way the team thinks of them.
Environments []environments.Environment
// Axis decomposes namespaces when one cluster holds several environments.
// Nil when the file configured none.
Axis *environments.Resolver
// AxisConfig is what Axis was built from, kept so the UI can explain it.
AxisConfig environments.Config
Defaults Defaults
// contains filtered or unexported fields
}
Config is the loaded, validated file.
func Empty ¶
func Empty() *Config
Empty is the zero-config state: no file, everything inferred. Callers that have no config still get a usable *Config rather than a nil check at every call site.
func Load ¶
Load reads the config, or returns an empty one when no file exists.
Discovery order: Options.Path, then KUBESIDE_CONFIG, then $XDG_CONFIG_HOME/kubeside/config.yaml, then ~/.config/kubeside/config.yaml. Nothing is created along the way; a missing file at the end of that list is the normal first run, not a failure.
func (*Config) AppRef ¶
AppRef returns the configured identity of an app in one environment, when the file overrode it.
func (*Config) Environment ¶
func (c *Config) Environment(kctx kubeconfig.Context) environments.Environment
Environment resolves one kubeconfig context.
Cluster URL wins over context name, since it survives every rename and every personal naming convention. A context the file says nothing about still classifies by name, so configuring one environment does not blind kubeside to the others.
type Defaults ¶
type Defaults struct {
// Namespaces is the list to read when cluster-scoped discovery is refused.
// Empty means probe: try listing, then the context's own namespace.
Namespaces []string
// Metrics selects the usage source: auto, metrics-server, prometheus, none.
Metrics string
}
Defaults are the fallbacks the file may set.