bootstrap

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: AGPL-3.0 Imports: 13 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
}

type BootstrapOption

type BootstrapOption func(*BootstrapConfig)

BootstrapOption defines the functional option to configure the bootstrap configuration.

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 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 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
}

Jump to

Keyboard shortcuts

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