adapter

package
v0.0.0-...-4658187 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2019 License: Apache-2.0 Imports: 60 Imported by: 0

Documentation

Overview

Package adapter provides adapters between Turbine Labs API objects and envoy xDS objects, in the form of an xDS server and ClusterCollector implementations

Index

Constants

View Source
const (
	// DefaultCluster is used as the Node's cluster name if none is provided
	DefaultCluster = "default-cluster"

	// DefaultZone is used as the Node's zone name if none is provided
	DefaultZone = "default-zone"
)

Variables

This section is empty.

Functions

func NewClusterCollector

func NewClusterCollector(addr, zoneName string, isJSON bool) (collector.ClusterCollector, error)

NewClusterCollector produces a ClusterCollector which connects to a CDS server on the given addr, and collects clusters for the given zone name. If isJSON is true, the JSON/REST transport will be used instead of gRPC.

Types

type MockXDS

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

MockXDS is a mock of XDS interface

func NewMockXDS

func NewMockXDS(ctrl *gomock.Controller) *MockXDS

NewMockXDS creates a new mock instance

func (*MockXDS) Addr

func (m *MockXDS) Addr() string

Addr mocks base method

func (*MockXDS) Consume

func (m *MockXDS) Consume(arg0 *poller.Objects) error

Consume mocks base method

func (*MockXDS) EXPECT

func (m *MockXDS) EXPECT() *MockXDSMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockXDS) Run

func (m *MockXDS) Run() error

Run mocks base method

func (*MockXDS) Stop

func (m *MockXDS) Stop()

Stop mocks base method

type MockXDSFromFlags

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

MockXDSFromFlags is a mock of XDSFromFlags interface

func NewMockXDSFromFlags

func NewMockXDSFromFlags(ctrl *gomock.Controller) *MockXDSFromFlags

NewMockXDSFromFlags creates a new mock instance

func (*MockXDSFromFlags) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockXDSFromFlags) Make

func (m *MockXDSFromFlags) Make(registrar poller.Registrar) (XDS, error)

Make mocks base method

func (*MockXDSFromFlags) Validate

func (m *MockXDSFromFlags) Validate() error

Validate mocks base method

type MockXDSFromFlagsMockRecorder

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

MockXDSFromFlagsMockRecorder is the mock recorder for MockXDSFromFlags

func (*MockXDSFromFlagsMockRecorder) Make

func (mr *MockXDSFromFlagsMockRecorder) Make(registrar interface{}) *gomock.Call

Make indicates an expected call of Make

func (*MockXDSFromFlagsMockRecorder) Validate

func (mr *MockXDSFromFlagsMockRecorder) Validate() *gomock.Call

Validate indicates an expected call of Validate

type MockXDSMockRecorder

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

MockXDSMockRecorder is the mock recorder for MockXDS

func (*MockXDSMockRecorder) Addr

func (mr *MockXDSMockRecorder) Addr() *gomock.Call

Addr indicates an expected call of Addr

func (*MockXDSMockRecorder) Consume

func (mr *MockXDSMockRecorder) Consume(arg0 interface{}) *gomock.Call

Consume indicates an expected call of Consume

func (*MockXDSMockRecorder) Run

func (mr *MockXDSMockRecorder) Run() *gomock.Call

Run indicates an expected call of Run

func (*MockXDSMockRecorder) Stop

func (mr *MockXDSMockRecorder) Stop() *gomock.Call

Stop indicates an expected call of Stop

type XDS

type XDS interface {
	poller.Consumer

	// Run starts the XDS server. This method does not return unless
	// the server fails to start or is stopped from another goroutine
	// via Stop().
	Run() error

	// Stop terminates a running XDS server. It attempts a graceful stop by
	// preventing new connections and waiting until pending RPCs are complete.
	Stop()

	// Addr retrieves the XDS server's listener address. Suitable for
	// retrieving the listener port when the initial address specified
	// port 0. If the server has not yet started, this method blocks.
	Addr() string
}

XDS manages the lifecyle of an envoy xDS server. It also implements poller.Consumer, to allow it to consume objects from the Turbine Labs API.

func NewXDS

func NewXDS(
	addr string,
	registrar poller.Registrar,
	caFile string,
	defaultTimeout time.Duration,
	resolveDNS bool,
	stats stats.Stats,
	options ...XDSOption,
) (XDS, error)

NewXDS creates new XDS instances with the given listener address, object source, certificate authority file, and default timeout.

type XDSFromFlags

type XDSFromFlags interface {
	// Make creates an XDS from the given poller.Registrar and command line flags.
	Make(registrar poller.Registrar) (XDS, error)
	// Validate verifies that all flags are correctly specified
	Validate() error
}

XDSFromFlags configures and validates an XDS

func NewXDSFromFlags

func NewXDSFromFlags(
	flags tbnflag.FlagSet,
	statsFromFlags stats.FromFlags,
) XDSFromFlags

NewXDSFromFlags installs a FromFlags in the given FlagSet

type XDSOption

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

XDSOption represents a configuration option for XDS.

func WithTopResponseLog

func WithTopResponseLog(n int, interval time.Duration) XDSOption

WithTopResponseLog logs the top N non-success downstream responses to the console every interval. Requires GRPC logging.

Jump to

Keyboard shortcuts

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