envoy

package
v1.14.4 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2022 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLoopbackAddr

func GetLoopbackAddr(port int) string

func GetLoopbackIp

func GetLoopbackIp() string

func SetupEnvoy

func SetupEnvoy(t *testing.T, adsAddress string, portmaps ...string)

SetupEnvoy launches an envoy docker container that is configured to connect to the supplied ads address and expose the supplied portmaps. A Cleanup function is registered to shutdown the container at the end of the test suite.

func SetupServer

func SetupServer(t *testing.T, handler http.Handler, addresses ...string)

SetupServer will launch an http server that runs for the duration of the test, binds to the supplied addresses using the supplied handler.

Types

type EnvoyController

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

EnvoyController runs a go control plane for envoy that tracks ACKS/NACKS for configuration updates. This allows code to know when envoy has successfully reconfigured as well as have access to the error details when envoy is fed invalid configuration.

func NewEnvoyController

func NewEnvoyController(address string) *EnvoyController

NewEnvoyControler creates a new envoy controller that binds to the supplied address when Run.

func SetupEnvoyController

func SetupEnvoyController(t *testing.T, address string) *EnvoyController

SetupEnvoyController will create and run an EnvoyController with the supplied address as well as registering a Cleanup function to shutdown the EnvoyController.

func (*EnvoyController) Configure

func (e *EnvoyController) Configure(node, version string, snapshot cache.Snapshot) *status.Status

Configure will update the envoy configuration and block until the reconfiguration either succeeds or signals an error.

func (*EnvoyController) Debugf

func (e *EnvoyController) Debugf(format string, args ...interface{})

The go control plane requires a logger to be injected. These methods implement the logger interface.

func (*EnvoyController) Errorf

func (e *EnvoyController) Errorf(format string, args ...interface{})

func (EnvoyController) ID

func (e EnvoyController) ID(node *core.Node) string

ID is a callback function that the go control plane uses. I don't know what it does.

func (*EnvoyController) Infof

func (e *EnvoyController) Infof(format string, args ...interface{})

func (*EnvoyController) OnFetchRequest

func (e *EnvoyController) OnFetchRequest(_ context.Context, r *v2.DiscoveryRequest) error

OnFetchRequest is called for each Fetch request

func (*EnvoyController) OnFetchResponse

func (e *EnvoyController) OnFetchResponse(req *v2.DiscoveryRequest, res *v2.DiscoveryResponse)

OnFetchResponse is called immediately prior to sending a response.

func (*EnvoyController) OnStreamClosed

func (e *EnvoyController) OnStreamClosed(sid int64)

OnStreamClosed is called immediately prior to closing an xDS stream with a stream ID.

func (*EnvoyController) OnStreamOpen

func (e *EnvoyController) OnStreamOpen(_ context.Context, sid int64, stype string) error

OnStreamOpen is called once an xDS stream is open with a stream ID and the type URL (or "" for ADS).

func (*EnvoyController) OnStreamRequest

func (e *EnvoyController) OnStreamRequest(sid int64, req *v2.DiscoveryRequest) error

OnStreamRequest is called once a request is received on a stream.

func (*EnvoyController) OnStreamResponse

func (e *EnvoyController) OnStreamResponse(sid int64, req *v2.DiscoveryRequest, res *v2.DiscoveryResponse)

OnStreamResponse is called immediately prior to sending a response on a stream.

func (*EnvoyController) Run

func (e *EnvoyController) Run(ctx context.Context) error

Run the ADS server.

func (*EnvoyController) Warnf

func (e *EnvoyController) Warnf(format string, args ...interface{})

type Prefixer

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

func NewPrefixer

func NewPrefixer(output io.Writer, prefix []byte) *Prefixer

func (*Prefixer) Write

func (p *Prefixer) Write(b []byte) (int, error)

type RequestLogger

type RequestLogger struct {
	Requests []*http.Request
}

func NewRequestLogger

func NewRequestLogger() *RequestLogger

func SetupRequestLogger

func SetupRequestLogger(t *testing.T, addresses ...string) *RequestLogger

SetupRequestLogger will launch an http server that binds to the supplied addresses, responds with the supplied body, and records every request it receives for later examination.

func (*RequestLogger) Log

func (rl *RequestLogger) Log(r *http.Request)

func (*RequestLogger) ServeHTTP

func (rl *RequestLogger) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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