envoy

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2021 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SupportedModes = []string{string(LoadBalancer)}

SupportedModes indicate the modes that are current supported by GetEnvoy

Functions

func NewRuntime

func NewRuntime(options ...RuntimeOption) (binary.FetchRunner, error)

NewRuntime creates a new Runtime with the local file storage set to the home directory

Types

type Config added in v0.1.1

type Config struct {
	XDSAddress     string
	Mode           Mode
	IPAddresses    []string
	ALSAddresss    string
	DrainDuration  *durationpb.Duration
	ConnectTimeout *durationpb.Duration
	AdminAddress   string
	AdminPort      int32
	StatNameLength int32
}

Config store Envoy config information for use by bootstrap and arg mutators

func NewConfig added in v0.1.1

func NewConfig(options ...func(*Config)) *Config

NewConfig creates and mutates a config object based on passed params

func (*Config) GetAdminAddress added in v0.2.1

func (c *Config) GetAdminAddress() string

GetAdminAddress returns a host:port formatted address of the Envoy admin listener.

type Mode added in v0.1.1

type Mode string

Mode is the mode Envoy should run in

const (
	// Sidecar instructs Envoy to run as a sidecar
	Sidecar Mode = "sidecar"
	// LoadBalancer instructs Envoy to run as a loadbalancer (e.g. gateway)
	LoadBalancer Mode = "loadbalancer"
)

func ParseMode added in v0.1.1

func ParseMode(s string) Mode

ParseMode converts the passed string into a valid mode or empty string

type Runtime

type Runtime struct {
	RootDir string

	TmplDir string
	Config  *Config

	WorkingDir string
	IO         ioutil.StdStreams
	// contains filtered or unexported fields
}

Runtime manages an Envoy lifecycle including fetching (if necessary) and running

func (*Runtime) AlreadyDownloaded

func (r *Runtime) AlreadyDownloaded(key *manifest.Key) bool

AlreadyDownloaded returns true if there is a cached Envoy binary matching the passed Key

func (*Runtime) AppendArgs added in v0.1.1

func (r *Runtime) AppendArgs(args []string)

AppendArgs appends the passed args to the child process' args

func (*Runtime) BinaryStore

func (r *Runtime) BinaryStore() string

BinaryStore returns the location at which the runtime instance persists binaries Getters typically aren't idiomatic Go, however, this one is deliberately part of the fetcher interface

func (*Runtime) DebugStore

func (r *Runtime) DebugStore() string

DebugStore returns the location at which the runtime instance persists debug data for this given instance Getters typically aren't idiomatic Go, however, this one is deliberately part of the runner interface

func (*Runtime) Fetch

func (r *Runtime) Fetch(key *manifest.Key, binaryLocation string) error

Fetch downloads an Envoy binary from the passed location

func (*Runtime) FetchAndRun added in v0.2.1

func (r *Runtime) FetchAndRun(reference string, args []string) error

FetchAndRun downloads an Envoy binary, if necessary, and runs it.

func (*Runtime) GetPid added in v0.1.7

func (r *Runtime) GetPid() (int, error)

GetPid returns the pid of the child process

func (*Runtime) RegisterDone

func (r *Runtime) RegisterDone()

RegisterDone informs the runtime that you have completed It is a wrapper around sync.WaitGroup.Done()

func (*Runtime) RegisterPreStart

func (r *Runtime) RegisterPreStart(f ...func(binary.Runner) error)

RegisterPreStart registers the passed functions to be run before Envoy has started

func (*Runtime) RegisterPreTermination

func (r *Runtime) RegisterPreTermination(f ...func(binary.Runner) error)

RegisterPreTermination registers the passed functions to be run after Envoy has started and just before GetEnvoy instructs Envoy to terminate

func (*Runtime) RegisterWait

func (r *Runtime) RegisterWait(delta int)

RegisterWait informs the runtime it needs to wait for you to complete It is a wrapper around sync.WaitGroup.Add()

func (*Runtime) Run

func (r *Runtime) Run(key *manifest.Key, args []string) error

Run execs the binary defined by the key with the args passed It is a blocking function that can only be terminated via SIGINT

func (*Runtime) RunPath

func (r *Runtime) RunPath(path string, args []string) error

RunPath execs the binary at the path with the args passed It is a blocking function that can only be terminated via SIGINT

func (*Runtime) SaveConfig added in v0.2.0

func (r *Runtime) SaveConfig(name, config string) (string, error)

SaveConfig saves configuration string in getenvoy directory.

func (*Runtime) SendSignal

func (r *Runtime) SendSignal(s os.Signal)

SendSignal sends a signal to the parent process

func (*Runtime) SetStderr

func (r *Runtime) SetStderr(fn func(io.Writer) io.Writer)

SetStderr writes the stderr of Envoy to the passed writer

func (*Runtime) SetStdout

func (r *Runtime) SetStdout(fn func(io.Writer) io.Writer)

SetStdout writes the stdout of Envoy to the passed writer

func (*Runtime) Status

func (r *Runtime) Status() int

Status indicates the state of the child process

func (*Runtime) Wait

func (r *Runtime) Wait(state int)

Wait blocks until the child process reaches the state passed Note: It does not guarantee that it is in the specified state just that it has reached it

func (*Runtime) WaitWithContext added in v0.1.1

func (r *Runtime) WaitWithContext(ctx context.Context, state int)

WaitWithContext blocks until the child process reaches the state passed or the context is canceled Note: It does not guarantee that it is in the specified state just that it has reached it

type RuntimeOption added in v0.2.1

type RuntimeOption func(*Runtime)

RuntimeOption represents a configuration option to NewRuntime.

func (RuntimeOption) And added in v0.2.1

And returns a combined list of configuration options.

func (RuntimeOption) AndAll added in v0.2.1

AndAll returns a combined list of configuration options.

type RuntimeOptions added in v0.2.1

type RuntimeOptions []RuntimeOption

RuntimeOptions represents a list of configuration options to NewRuntime.

func (RuntimeOptions) And added in v0.2.1

And returns a combined list of configuration options.

func (RuntimeOptions) AndAll added in v0.2.1

AndAll returns a combined list of configuration options.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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