config

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package config loads and validates the agent configuration file (docs/configuration.md).

Index

Constants

View Source
const (
	RoleNode        = "node"
	RoleCoordinator = "coordinator"
	RoleHost        = "host"
)

Roles.

View Source
const (
	CapInventory = "inventory"
	CapMetrics   = "metrics"
	CapLogs      = "logs"
	CapPackages  = "packages"
)

Capabilities.

View Source
const (
	SourcePrometheus      = "prometheus"
	SourceMimir           = "mimir"
	SourceVictoriaMetrics = "victoriametrics"
	SourceLoki            = "loki"
	SourceVictoriaLogs    = "victorialogs"
)

Lookback source types (PRD I6a, I6b).

Variables

This section is empty.

Functions

func ParseBytes

func ParseBytes(s string) (int64, error)

ParseBytes parses a size such as 16Mi or 1G.

Types

type AirGap

type AirGap struct {
	Enabled   bool   `yaml:"enabled"`
	BundleDir string `yaml:"bundleDir"`
	ExportDir string `yaml:"exportDir"`
}

AirGap configures the air-gap profile (PRD A9).

type Bytes

type Bytes int64

Bytes is a byte size accepting suffixes Ki, Mi, Gi, Ti, K, M, G, T.

func (*Bytes) UnmarshalYAML

func (b *Bytes) UnmarshalYAML(n *yaml.Node) error

type Config

type Config struct {
	Role                string         `yaml:"role"`
	Endpoint            string         `yaml:"endpoint"`
	EndpointCAFile      string         `yaml:"endpointCAFile"`
	EnrollmentTokenFile string         `yaml:"enrollmentTokenFile"`
	StateDir            string         `yaml:"stateDir"`
	Capabilities        []string       `yaml:"capabilities"`
	Kubernetes          Kubernetes     `yaml:"kubernetes"`
	Coordinator         Coordinator    `yaml:"coordinator"`
	Spool               Spool          `yaml:"spool"`
	Node                Node           `yaml:"node"`
	Host                Host           `yaml:"host"`
	Lookback            []Lookback     `yaml:"lookback"`
	AirGap              AirGap         `yaml:"airgap"`
	Trust               Trust          `yaml:"trust"`
	Policy              Policy         `yaml:"policy"`
	Investigation       Investigation  `yaml:"investigation"`
	ImageInventory      ImageInventory `yaml:"imageInventory"`
	Logging             Logging        `yaml:"logging"`
}

Config is the full agent configuration.

func Load

func Load(path string) (*Config, error)

Load reads, defaults, and validates a configuration file.

func Parse

func Parse(b []byte) (*Config, error)

Parse decodes YAML strictly, applies defaults, and validates.

func (*Config) ApplyDefaults

func (c *Config) ApplyDefaults()

ApplyDefaults fills unset fields with the proposed defaults of PRD 8.2 and H15.

func (*Config) HasCapability

func (c *Config) HasCapability(cap string) bool

HasCapability reports whether cap is enabled.

func (*Config) Validate

func (c *Config) Validate() error

Validate rejects inconsistent configuration.

type Coordinator

type Coordinator struct {
	Listen      string `yaml:"listen"`
	TLSCertFile string `yaml:"tlsCertFile"`
	TLSKeyFile  string `yaml:"tlsKeyFile"`
	ServiceURL  string `yaml:"serviceURL"`
	CAFile      string `yaml:"caFile"`
	Audience    string `yaml:"audience"`
	TokenFile   string `yaml:"tokenFile"`
	Namespace   string `yaml:"namespace"`
	PodName     string `yaml:"podName"`
}

Coordinator configures the coordinator listener and the node side of the node API.

type CustomResources added in v0.12.0

type CustomResources struct {
	Enabled   *bool    `yaml:"enabled"`
	MaxKinds  int      `yaml:"maxKinds"`
	MaxScopes int      `yaml:"maxScopes"`
	Include   []string `yaml:"include"`
	Exclude   []string `yaml:"exclude"`
}

CustomResources controls bounded background collection independently of built-in resources.

func (CustomResources) Active added in v0.12.0

func (c CustomResources) Active() bool

type Duration

type Duration time.Duration

Duration accepts Go duration strings.

func (Duration) D

func (d Duration) D() time.Duration

func (*Duration) UnmarshalYAML

func (d *Duration) UnmarshalYAML(n *yaml.Node) error

type Host

type Host struct {
	DiskCap          Bytes    `yaml:"diskCap"`
	SpoolReserve     Bytes    `yaml:"spoolReserve"`
	TSDBMax          Bytes    `yaml:"tsdbMax"`
	EvidenceRing     Bytes    `yaml:"evidenceRing"`
	ScrapeInterval   Duration `yaml:"scrapeInterval"`
	LogFiles         []string `yaml:"logFiles"`
	Journal          bool     `yaml:"journal"`
	JournalDir       string   `yaml:"journalDir"`
	MetricsEndpoints []string `yaml:"metricsEndpoints"`
	AllowNonLoopback bool     `yaml:"allowNonLoopback"`
}

Host configures host mode (PRD 7.10).

type ImageInventory added in v0.19.0

type ImageInventory struct {
	Enabled        *bool    `yaml:"enabled"`
	ContentStore   string   `yaml:"contentStore"`
	MaxLayerBytes  Bytes    `yaml:"maxLayerBytes"`
	MaxFiles       int      `yaml:"maxFiles"`
	MaxStagedBytes Bytes    `yaml:"maxStagedBytes"`
	MaxPackages    int      `yaml:"maxPackages"`
	Timeout        Duration `yaml:"timeout"`
	CacheEntries   int      `yaml:"cacheEntries"`
	CacheBytes     Bytes    `yaml:"cacheBytes"`
}

ImageInventory configures package inventories of running images read from the containerd content store.

func (ImageInventory) Active added in v0.19.0

func (i ImageInventory) Active() bool

type Investigation

type Investigation struct {
	MaxConcurrency int      `yaml:"maxConcurrency"`
	Timeout        Duration `yaml:"timeout"`
	MaxBytes       Bytes    `yaml:"maxBytes"`
	MaxLines       int      `yaml:"maxLines"`
	MaxSeries      int      `yaml:"maxSeries"`
	MaxSamples     int      `yaml:"maxSamples"`
	MaxWindow      Duration `yaml:"maxWindow"`
}

Investigation bounds live queries (PRD I3).

type Kubernetes

type Kubernetes struct {
	Scope               string          `yaml:"scope"`
	Namespaces          []string        `yaml:"namespaces"`
	ExcludeNamespaces   []string        `yaml:"excludeNamespaces"`
	LabelAllowlist      []string        `yaml:"labelAllowlist"`
	AnnotationAllowlist []string        `yaml:"annotationAllowlist"`
	Resources           []string        `yaml:"resources"`
	CustomResources     CustomResources `yaml:"customResources"`
	ClusterName         string          `yaml:"clusterName"`
}

Kubernetes configures collection scope (PRD A3, 7.2).

type Logging

type Logging struct {
	Level  string `yaml:"level"`
	Format string `yaml:"format"`
}

Logging configures diagnostics.

type Lookback

type Lookback struct {
	Name              string   `yaml:"name"`
	Type              string   `yaml:"type"`
	URL               string   `yaml:"url"`
	Tenant            string   `yaml:"tenant"`
	AccountID         string   `yaml:"accountID"`
	ProjectID         string   `yaml:"projectID"`
	BearerTokenFile   string   `yaml:"bearerTokenFile"`
	BasicUsernameFile string   `yaml:"basicUsernameFile"`
	BasicPasswordFile string   `yaml:"basicPasswordFile"`
	CAFile            string   `yaml:"caFile"`
	Timeout           Duration `yaml:"timeout"`
	Retention         Duration `yaml:"retention"`
}

Lookback is one optional read-only external store (PRD I6).

type Node

type Node struct {
	Name           string   `yaml:"name"`
	DiskCap        Bytes    `yaml:"diskCap"`
	EvidenceRing   Bytes    `yaml:"evidenceRing"`
	LogsPath       string   `yaml:"logsPath"`
	ScrapeInterval Duration `yaml:"scrapeInterval"`
	MaxTargets     int      `yaml:"maxTargets"`
	MaxSeries      int      `yaml:"maxSeries"`
	MaxSamplesRate int      `yaml:"maxSamplesPerSecond"`
	KubeletTLS     string   `yaml:"kubeletTLS"`
	KubeletPort    int      `yaml:"kubeletPort"`
	// HostMetrics gathers node memory from ProcPath and physical network devices from SysPath (default true).
	HostMetrics *bool  `yaml:"hostMetrics"`
	ProcPath    string `yaml:"procPath"`
	SysPath     string `yaml:"sysPath"`
	// HostRoot is where the host's package databases and os-release are mounted read-only.
	HostRoot         string   `yaml:"hostRoot"`
	PackagesInterval Duration `yaml:"packagesInterval"`
}

Node configures a node agent (PRD 6.3, 7.6).

func (Node) HostMetricsEnabled added in v0.20.0

func (n Node) HostMetricsEnabled() bool

HostMetricsEnabled reports whether the node agent gathers node memory and network series.

type Policy

type Policy struct {
	MaxRuleEvalTime   Duration `yaml:"maxRuleEvalTime"`
	MaxRuleSamples    int      `yaml:"maxRuleSamples"`
	MaxRuleSeries     int      `yaml:"maxRuleSeries"`
	MaxCounterBytes   Bytes    `yaml:"maxCounterBytes"`
	MaxEvidenceBytes  Bytes    `yaml:"maxEvidenceBytes"`
	DisabledRules     []string `yaml:"disabledRules"`
	LateThreshold     Duration `yaml:"lateThreshold"`
	RedactionPatterns []string `yaml:"redactionPatterns"`
}

Policy is the local administrator upper bound on rules (PRD 7.5).

func (Policy) Bundle added in v0.4.0

func (p Policy) Bundle(target string) bundle.Policy

Bundle returns the built-in bundle limits for target, lowered where the local policy is stricter.

type Spool

type Spool struct {
	Capacity   Bytes   `yaml:"capacity"`
	Window     Bytes   `yaml:"window"`
	CoalesceAt float64 `yaml:"coalesceAt"`
}

Spool sizes the coordinator spool (PRD 8.2).

type Trust

type Trust struct {
	// Roots are "<id>:<base64 ed25519 public key>" entries.
	Roots     []string `yaml:"roots"`
	RootsFile string   `yaml:"rootsFile"`
	Threshold int      `yaml:"threshold"`
}

Trust is the public half of the ExitMesh workspace's agent trust root (PRD R2a), shown on the connector page.

Jump to

Keyboard shortcuts

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