Documentation
¶
Index ¶
- Constants
- func ApplyBootstrapConfig(boostrapConfig *egv1a1.ProxyBootstrap, defaultBootstrap string) (string, error)
- func GetCgroupMemoryLimit() uint64
- func GetDefaultMaxHeapSizeBytes() *uint64
- func GetRenderedBootstrapConfig(opts ...BootstrapOption) (string, error)
- type BootstrapConfig
- type BootstrapOption
- func WithMetricSinkIdentity(proxy, replica, projectID string) BootstrapOption
- func WithOtelMetricSink(host string, port uint32) BootstrapOption
- func WithOverloadMaxActiveConnections(count uint64) BootstrapOption
- func WithOverloadMaxHeapSizeBytes(size uint64) BootstrapOption
- func WithStatsFlushInterval(d time.Duration) BootstrapOption
- func WithWatchdogTimeouts(miss, megamiss time.Duration) BootstrapOption
- func WithXdsServerHost(host string) BootstrapOption
- func WithXdsServerPort(port int32) BootstrapOption
- func WithXdsTLS() BootstrapOption
- func WithXdsTLSCAPath(caPath string) BootstrapOption
- type CgroupMemoryDetector
- type DefaultFileReader
- type FileReader
- type MemoryDetector
- type MetricSinkIdentity
- type OverloadManagerParameters
- type StatsMatcherParameters
- type WatchdogParameters
Constants ¶
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
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 ¶
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 StatsMatcherParameters ¶
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.