config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
const EnvVar = "KUBESIDE_CONFIG"

EnvVar points at a shared config file, typically one a team commits.

Variables

This section is empty.

Functions

This section is empty.

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

func Load(opts Options) (*Config, error)

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

func (c *Config) AppRef(app, env string) (Ref, bool)

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.

type Options

type Options struct {
	// Path overrides discovery. A path that does not exist is an error: the
	// caller asked for that file specifically.
	Path string
}

Options controls where the config is read from.

type Ref

type Ref struct {
	Namespace string
	Name      string
}

Ref is one app in one environment, when the name or namespace differs.

Jump to

Keyboard shortcuts

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