envoy

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Proxy

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

Proxy manages an Envoy proxy process.

TODO(NET-118): properly handle the Envoy process lifecycle, including restarting crashed processes.

func NewProxy

func NewProxy(cfg ProxyConfig) (*Proxy, error)

NewProxy creates a Proxy with the given configuration.

Use Run to start the Envoy proxy process.

func (*Proxy) Drain added in v1.0.4

func (p *Proxy) Drain() error

Start draining inbound connections to the Envoy proxy process.

Note: the caller is responsible for ensuring Drain is not called concurrently with Run, as this is thread-unsafe.

func (*Proxy) DumpConfig added in v1.1.3

func (p *Proxy) DumpConfig() error

Dump Envoy config to disk.

func (*Proxy) Exited

func (p *Proxy) Exited() chan error

Exited returns a channel that is closed when the Envoy process exits. It can be used to detect and act on process crashes.

func (*Proxy) Kill added in v1.0.4

func (p *Proxy) Kill() error

Forcefully kill the Envoy proxy process.

Note: the caller is responsible for ensuring Stop is not called concurrently with Run, as this is thread-unsafe.

func (*Proxy) Quit added in v1.0.4

func (p *Proxy) Quit() error

Gracefully stop the Envoy proxy process.

Note: the caller is responsible for ensuring Quit is not called concurrently with Run, as this is thread-unsafe.

func (*Proxy) Ready added in v1.3.0

func (p *Proxy) Ready() (bool, error)

func (*Proxy) Run

func (p *Proxy) Run(ctx context.Context) error

Run the Envoy proxy process.

The caller is responsible for terminating the Envoy process with Stop. If it crashes the caller can be notified by receiving on the Exited channel.

Run may only be called once. It is not possible to restart a stopped proxy.

type ProxyConfig

type ProxyConfig struct {
	// ExecutablePath is the path to the Envoy executable.
	//
	// Defaults to whichever executable called envoy is found on $PATH.
	ExecutablePath string

	// AdminAddr is the hostname or IP address of the Envoy admin interface.
	//
	// Defaults to 127.0.0.1
	AdminAddr string

	// AdminBindPort is the port of the Envoy admin interface.
	//
	// Defaults to 19000
	AdminBindPort int

	// ExtraArgs are additional arguments that will be passed to Envoy.
	ExtraArgs []string

	// Logger that will be used to emit log messages.
	//
	// Note: Envoy logs are *not* written to this logger, and instead are written
	// directly to EnvoyOutputStream + EnvoyErrorStream.
	Logger hclog.Logger

	// LogJSON determines whether the logs emitted by Envoy will be in JSON format.
	LogJSON bool

	// EnvoyErrorStream is the io.Writer to which the Envoy output stream will be redirected.
	// Envoy writes process debug logs to the error stream.
	EnvoyErrorStream io.Writer

	// EnvoyOutputStream is the io.Writer to which the Envoy output stream will be redirected.
	// The default Consul access log configuration write logs to the output stream.
	EnvoyOutputStream io.Writer

	// BootstrapConfig is the Envoy bootstrap configuration (in YAML or JSON format)
	// that will be provided to Envoy via the --config-path flag.
	BootstrapConfig []byte
}

ProxyConfig contains the configuration required to run an Envoy proxy.

type ProxyManager added in v1.0.4

type ProxyManager interface {
	Run(ctx context.Context) error
	Drain() error
	Quit() error
	Kill() error
	DumpConfig() error
	Ready() (bool, error)
}

ProxyManager is an interface for managing an Envoy proxy process.

Jump to

Keyboard shortcuts

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