envoy

package
v0.0.0-...-d07e290 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: Apache-2.0 Imports: 22 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DrainListeners

func DrainListeners(adminPort uint32, inboundonly bool, skipExit bool) error

DrainListeners drains inbound listeners of Envoy so that inflight requests can gracefully finish and even continue making outbound calls as needed.

Types

type Agent

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

func NewAgent

func NewAgent(proxy Proxy, terminationDrainDuration, minDrainDuration time.Duration, localhost string,
	adminPort, statusPort, prometheusPort int, exitOnZeroActiveConnections bool,
) *Agent

NewAgent creates a new proxy agent for the proxy start-up and clean-up functions.

func (*Agent) DisableDraining

func (a *Agent) DisableDraining()

func (*Agent) DrainNow

func (a *Agent) DrainNow()

func (*Agent) Run

func (a *Agent) Run(ctx context.Context)

Run starts the envoy and waits until it terminates. There are a few exit paths:

  1. Envoy exits. In this case, we simply log and exit.
  2. /quitquitquit (on agent, not Envoy) is called. We will set skipDrain and cancel the context, which triggers us to exit immediately.
  3. SIGTERM. We will drain, wait termination drain duration, then exit. This is the standard pod shutdown; SIGTERM arrives when pod shutdown starts. If the pod's terminationGracePeriod is shorter than our drain duration (rare), we may be a SIGKILL.
  4. /drain + SIGTERM. This is the shutdown when using Kubernetes native sidecars. /drain is called when the pod shutdown starts. We start draining, forever. Once the app containers shutdown, we get a SIGTERM. We have no use to run anymore, so shutdown immediately. If somehow we do not shutdown from the SIGTERM fast enough, we may get a SIGKILL later.

type Proxy

type Proxy interface {
	// Run command with an abort channel
	Run(<-chan error) error

	// Drains the envoy process.
	Drain(skipExit bool) error

	// Cleanup command for cleans up the proxy.
	Cleanup()

	// UpdateConfig writes a new config file
	UpdateConfig(config []byte) error
}

Proxy defines command interface for a proxy

func NewProxy

func NewProxy(cfg ProxyConfig) Proxy

NewProxy creates an instance of the proxy control commands

type ProxyConfig

type ProxyConfig struct {
	LogLevel          string
	ComponentLogLevel string
	NodeIPs           []string
	Sidecar           bool
	LogAsJSON         bool
	OutlierLogPath    string

	BinaryPath    string
	ConfigPath    string
	ConfigCleanup bool
	AdminPort     int32
	DrainDuration *durationpb.Duration
	Concurrency   int32

	// For unit testing, in combination with NoEnvoy prevents agent.Run from blocking
	TestOnly    bool
	AgentIsRoot bool
}

Envoy binary flags

Jump to

Keyboard shortcuts

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