manager

package
v0.0.0-...-c46dd35 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package manager provides shared bootstrap logic for controller-runtime managers used by both the agent and registrar commands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterFlags

func RegisterFlags(cmd *cobra.Command, cfg *Config)

RegisterFlags binds the common manager configuration flags to the given command.

Telemetry is aether system config: enabling OTEL and the collector endpoint are set once for the whole system (the aether umbrella chart's global values) and passed to every component as these flags. The proxy data plane can override its own observability via MeshConfig, but the control-plane components inherit the system config wholesale.

func SetupLogging

func SetupLogging(debug bool, name string) *slog.Logger

SetupLogging creates a stderr slog logger named name and points controller-runtime at it (via the logr→slog bridge).

func SetupManagerLogging

func SetupManagerLogging(ctx context.Context, cfg Config, name, version string) (*slog.Logger, func(context.Context) error, error)

SetupManagerLogging is SetupLogging for manager-based components (agent, registrar). When cfg.LogsEnabled and an OTLP endpoint are set, it also creates an OTel LoggerProvider and fans the logger out to the otelslog bridge, so records go to both stderr (kubectl logs) and OTLP → collector. Because slog's Handle is context-aware, otelslog populates trace_id/span_id natively from the ctx passed to the *Context log methods. controller-runtime is wired via the logr→slog bridge over the same handler. The returned shutdown flushes and stops the LoggerProvider; it is nil when OTLP logging is disabled.

Types

type Config

type Config struct {
	// CacheOptions optionally scopes the manager's informer cache (e.g. the
	// agent limits Pod watches to its own node). Nil keeps the default cache.
	CacheOptions *cache.Options
	// Debug enables debug logging
	Debug bool
	// HealthProbeBindAddress is the address for the health probe HTTP server
	HealthProbeBindAddress string
	// MetricsEnabled enables the controller-runtime Prometheus metrics server
	MetricsEnabled bool
	// MetricsBindAddress is the address for the metrics HTTP server
	MetricsBindAddress string
	// LeaderElection enables controller-runtime leader election so only one
	// replica is active (used by the aether-controller singleton).
	LeaderElection bool
	// LeaderElectionID is the name of the lease resource used for leader election.
	LeaderElectionID string
	// OTelEnabled enables the OTel MeterProvider with Prometheus exporter bridge
	OTelEnabled bool
	// OTLPEndpoint is the OTLP gRPC collector endpoint (e.g. "localhost:4317"); empty disables OTLP export
	OTLPEndpoint string
	// LogsEnabled enables the OTel LoggerProvider with OTLP log export, tee'd into
	// the component's slog logger (requires OTLPEndpoint); stderr logging is unaffected
	LogsEnabled bool
	// TraceSampleRate is the head-sampling ratio for traces (0.0–1.0). The
	// TracerProvider is always installed (for trace_id on logs); this only bounds
	// what gets exported when TracingExport is set.
	TraceSampleRate float64
	// TracingExport attaches the OTLP span exporter; without it the always-on
	// TracerProvider still gives logs their trace_id but exports no spans (no
	// trace backend needed)
	TracingExport bool
}

Config holds common configuration shared across all controller-runtime manager-based commands.

type Result

type Result struct {
	Manager  ctrl.Manager
	Shutdown func(context.Context) error // nil if neither OTel metrics nor tracing enabled
}

Result holds the bootstrapped manager and an optional telemetry shutdown function.

func Bootstrap

func Bootstrap(ctx context.Context, cfg Config, serviceName, serviceVersion string, optFns ...func(*ctrl.Options)) (*Result, error)

Bootstrap sets up telemetry (if enabled), creates a controller-runtime Manager, and registers the standard health and readiness probes. Optional opts mutate the ctrl.Options before the manager is built (e.g. to supply a custom webhook server backed by SPIRE).

Jump to

Keyboard shortcuts

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