bootstrap

package
v0.23.1 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// EnvoyAdminAddress is the listening address of the envoy admin interface.
	EnvoyAdminAddress = "127.0.0.1"
	// EnvoyAdminPort is the port used to expose admin interface.
	EnvoyAdminPort = 19000

	// DefaultXdsServerPort is the default listening port of the xds-server.
	DefaultXdsServerPort = 18000

	// DefaultTLSCAPath is the default path to system CA certificates.
	DefaultTLSCAPath = "/etc/ssl/certs/ca-certificates.crt"

	EnvoyReadinessPort = 19001
	EnvoyReadinessPath = "/ready"
)

Variables

This section is empty.

Functions

func ApplyBootstrapConfig

func ApplyBootstrapConfig(boostrapConfig *egv1a1.ProxyBootstrap, defaultBootstrap string) (string, error)

ApplyBootstrapConfig applies the bootstrap config to the default bootstrap config and return the result config.

func GetCgroupMemoryLimit

func GetCgroupMemoryLimit() uint64

GetCgroupMemoryLimit returns the cgroup memory limit using the default detector

func GetDefaultMaxHeapSizeBytes

func GetDefaultMaxHeapSizeBytes() *uint64

GetDefaultMaxHeapSizeBytes returns the default max heap size in bytes based on cgroup memory limit

func GetRenderedBootstrapConfig

func GetRenderedBootstrapConfig(opts ...BootstrapOption) (string, error)

GetRenderedBootstrapConfig renders the bootstrap YAML string.

Types

type BootstrapConfig

type BootstrapConfig struct {
	// XdsServerHost is the DNS name of the Xds Server within Envoy Gateway.
	XdsServerHost string
	// XdsServerPort is the port of the Xds Server within Envoy Gateway.
	XdsServerPort int32
	// XdsTLSCAPath enables TLS for the xDS server connection using the CA certificate at this path.
	// Empty string disables TLS.
	XdsTLSCAPath string
	// OverloadMaxHeapSizeBytes defines the maximum heap size in bytes for the Envoy overload manager.
	OverloadMaxHeapSizeBytes *uint64
	// OverloadMaxActiveDownstreamConnections defines the maximum number of active downstream connections for the Envoy overload manager.
	OverloadMaxActiveDownstreamConnections *uint64
	// OtelMetricSinks are the OpenTelemetry metric sinks Envoy reports stats to.
	// An empty list leaves the stats sink section out of the bootstrap.
	OtelMetricSinks []metricSink
	// MetricSinkIdentity names the proxy the stats come from. A nil value adds
	// no identity tags.
	MetricSinkIdentity *MetricSinkIdentity
	// StatsFlushInterval is how often Envoy flushes stats to the sinks. A zero
	// value leaves Envoy on its own default.
	StatsFlushInterval time.Duration
	// WatchdogMissTimeout is the time after which a stalled Envoy thread counts
	// as a watchdog miss.
	WatchdogMissTimeout time.Duration
	// WatchdogMegamissTimeout is the time after which a stalled Envoy thread
	// counts as a watchdog megamiss.
	WatchdogMegamissTimeout time.Duration
}

func Resolve added in v0.23.1

func Resolve(opts ...BootstrapOption) *BootstrapConfig

Resolve returns the effective bootstrap values without rendering the configuration. The backplane publishes the overload manager ceilings as gauges, so a dashboard can draw the limit next to the value Envoy reports.

type BootstrapOption

type BootstrapOption func(*BootstrapConfig)

BootstrapOption defines the functional option to configure the bootstrap configuration.

func WithMetricSinkIdentity added in v0.23.1

func WithMetricSinkIdentity(proxy, replica, projectID string) BootstrapOption

WithMetricSinkIdentity names the proxy Envoy reports its stats for.

func WithOtelMetricSink added in v0.23.0

func WithOtelMetricSink(host string, port uint32) BootstrapOption

WithOtelMetricSink adds an OpenTelemetry metric sink at host:port. Envoy reports its stats to every sink added, each through its own cluster, so calling this more than once fans the stats out rather than replacing a sink.

func WithOverloadMaxActiveConnections

func WithOverloadMaxActiveConnections(count uint64) BootstrapOption

WithOverloadMaxActiveConnections sets the maximum number of active downstream connections for the Envoy overload manager.

func WithOverloadMaxHeapSizeBytes

func WithOverloadMaxHeapSizeBytes(size uint64) BootstrapOption

WithOverloadMaxHeapSizeBytes sets the maximum heap size in bytes for the Envoy overload manager.

func WithStatsFlushInterval added in v0.23.0

func WithStatsFlushInterval(d time.Duration) BootstrapOption

WithStatsFlushInterval sets how often Envoy flushes stats to the sinks. A value of zero or less leaves Envoy on its own default.

func WithWatchdogTimeouts added in v0.23.1

func WithWatchdogTimeouts(miss, megamiss time.Duration) BootstrapOption

WithWatchdogTimeouts sets the Envoy watchdog miss and megamiss timeouts. A value of zero or less keeps the default for that timeout. The watchdog never kills the process, so these timeouts only change when Envoy counts a stalled thread.

func WithXdsServerHost

func WithXdsServerHost(host string) BootstrapOption

WithXdsServerHost sets the Xds Server host.

func WithXdsServerPort

func WithXdsServerPort(port int32) BootstrapOption

WithXdsServerPort sets the Xds Server port. The default port is 18000.

func WithXdsTLS

func WithXdsTLS() BootstrapOption

WithXdsTLS enables TLS for the xDS server connection using system CA certificates.

func WithXdsTLSCAPath

func WithXdsTLSCAPath(caPath string) BootstrapOption

WithXdsTLSCAPath enables TLS for the xDS server connection using the CA certificate at the given path.

type CgroupMemoryDetector

type CgroupMemoryDetector struct {
	// contains filtered or unexported fields
}

CgroupMemoryDetector detects cgroup memory limits

func NewCgroupMemoryDetector

func NewCgroupMemoryDetector() *CgroupMemoryDetector

NewCgroupMemoryDetector creates a new CgroupMemoryDetector with default paths

func (*CgroupMemoryDetector) GetDefaultMaxHeapSizeBytes

func (d *CgroupMemoryDetector) GetDefaultMaxHeapSizeBytes() *uint64

GetDefaultMaxHeapSizeBytes returns the default max heap size in bytes based on cgroup memory limit

func (*CgroupMemoryDetector) GetMemoryLimit

func (d *CgroupMemoryDetector) GetMemoryLimit() uint64

GetMemoryLimit returns the cgroup memory limit in bytes. It tries to detect both cgroup v1 and v2 memory limits. If no limit is found, it returns 0.

type DefaultFileReader

type DefaultFileReader struct{}

DefaultFileReader is the default implementation of FileReader

func (DefaultFileReader) Open

func (r DefaultFileReader) Open(name string) (*os.File, error)

Open opens a file using os.Open

func (DefaultFileReader) ReadFile

func (r DefaultFileReader) ReadFile(filename string) ([]byte, error)

ReadFile reads a file using os.ReadFile

type FileReader

type FileReader interface {
	ReadFile(filename string) ([]byte, error)
	Open(name string) (*os.File, error)
}

FileReader is an interface for reading files, used for testing

type MemoryDetector

type MemoryDetector interface {
	GetMemoryLimit() uint64
	GetDefaultMaxHeapSizeBytes() *uint64
}

MemoryDetector is an interface for memory limit detection

type MetricSinkIdentity added in v0.23.1

type MetricSinkIdentity struct {
	// Proxy is the name of the Proxy the replica belongs to.
	Proxy string
	// Replica is the name of this replica.
	Replica string
	// ProjectID is the Apoxy project, which is empty on a self-hosted install.
	ProjectID string
}

MetricSinkIdentity names the proxy the Envoy stats come from. Envoy reports it as a fixed tag on every stat.

type OverloadManagerParameters

type OverloadManagerParameters struct {
	// MaxHeapSizeBytes defines the maximum heap size in bytes.
	MaxHeapSizeBytes *uint64
	// MaxActiveDownstreamConnections defines the maximum number of active downstream connections.
	MaxActiveDownstreamConnections *uint64
}

type StatsMatcherParameters

type StatsMatcherParameters struct {
	Exacts             []string
	Prefixs            []string
	Suffixs            []string
	RegularExpressions []string
}

type WatchdogParameters added in v0.23.1

type WatchdogParameters struct {
	// MissTimeout is the time after which a stalled thread counts as a miss.
	MissTimeout string
	// MegamissTimeout is the time after which a stalled thread counts as a megamiss.
	MegamissTimeout string
}

WatchdogParameters holds the watchdog timeouts, already rendered as proto duration literals.

Jump to

Keyboard shortcuts

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