View Source
const (
	// DefaultLogLevel the log level used for Envoy if not specified.
	DefaultLogLevel = LogLevelWarning

	// DefaultLogEntryPrefix the default prefix for all log lines from Envoy.
	DefaultLogEntryPrefix = "[ENVOY]"


This section is empty.


func GetConfigDump

func GetConfigDump(adminPort int) (*envoy_admin_v2alpha.ConfigDump, error)

GetConfigDump polls Envoy admin port for the config dump and returns the response.

func GetConfigDumpStr

func GetConfigDumpStr(adminPort int) (string, error)

GetConfigDumpStr polls Envoy admin port for the config dump and returns the response as a string.

func IsClusterPresent

func IsClusterPresent(cfg *envoy_admin_v2alpha.ConfigDump, clusterName string) bool

IsClusterPresent inspects the given Envoy config dump, looking for the given cluster

func IsOutboundListenerPresent

func IsOutboundListenerPresent(cfg *envoy_admin_v2alpha.ConfigDump, listenerName string) bool

IsOutboundListenerPresent inspects the given Envoy config dump, looking for the given listener.

func IsOutboundRoutePresent

func IsOutboundRoutePresent(cfg *envoy_admin_v2alpha.ConfigDump, clusterName string) bool

IsOutboundRoutePresent inspects the given Envoy config dump, looking for an outbound route which targets the given cluster.

func WaitForHealthCheckLive

func WaitForHealthCheckLive(adminPort int) error

WaitForHealthCheckLive polls the server info for Envoy and waits for it to transition to "live".


type Envoy

type Envoy struct {
	// YamlFile (required) the v2 yaml config file for Envoy.
	YamlFile string
	// BinPath (optional) the path to the Envoy binary. If not set, uses the debug binary under ISTIO_OUT. If the
	// ISTIO_OUT environment variable is not set, the default location under GOPATH is assumed. If ISTIO_OUT contains
	// multiple debug binaries, the most recent file is used.
	BinPath string
	// LogFilePath (optional) Sets the output log file for Envoy. If not set, Envoy will output to stderr.
	LogFilePath string
	// LogLevel (optional) if provided, sets the log level for Envoy. If not set, DefaultLogLevel will be used.
	LogLevel LogLevel
	// LogEntryPrefix (optional) if provided, sets the prefix for every log line from this Envoy. Defaults to DefaultLogPrefix.
	LogEntryPrefix string
	// contains filtered or unexported fields

Envoy is a wrapper that simplifies running Envoy.

func (*Envoy) Start

func (e *Envoy) Start() (err error)

Start starts the Envoy process.

func (*Envoy) Stop

func (e *Envoy) Stop() error

Stop kills the Envoy process. TODO: separate returning of baseID, to make it work with Envoy's hot restart.

type HealthCheckState

type HealthCheckState string

HealthCheckState represents a health checking state returned from /server_info

const (
	// HealthCheckLive indicates Envoy is live and ready to serve requests
	HealthCheckLive HealthCheckState = "LIVE"
	// HealthCheckDraining indicates Envoy is not currently capable of serving requests
	HealthCheckDraining HealthCheckState = "DRAINING"

type LogLevel

type LogLevel string

LogLevel represents the log level to use for Envoy.

const (
	// LogLevelTrace level
	LogLevelTrace LogLevel = "trace"
	// LogLevelDebug level
	LogLevelDebug LogLevel = "debug"
	// LogLevelInfo level
	LogLevelInfo LogLevel = "info"
	// LogLevelWarning level
	LogLevelWarning LogLevel = "warning"
	// LogLevelError level
	LogLevelError LogLevel = "error"
	// LogLevelCritical level
	LogLevelCritical LogLevel = "critical"
	// LogLevelOff level
	LogLevelOff = "off"

type ServerInfo

type ServerInfo struct {
	ProcessName                  string
	CompiledSHABuildType         string
	HealthCheckState             HealthCheckState
	CurrentHotRestartEpochUptime time.Duration
	TotalUptime                  time.Duration
	CurrentHotRestartEpoch       int

ServerInfo is the result of a request to /server_info

func GetServerInfo

func GetServerInfo(adminPort int) (ServerInfo, error)

GetServerInfo returns a structure representing a call to /server_info


Path Synopsis