adsc

package
v0.0.0-...-1a56975 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2019 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrTimeout is returned by Wait if no update is received in the given time.
	ErrTimeout = errors.New("timeout")
)

Functions

This section is empty.

Types

type ADSC

type ADSC struct {

	// InitialLoad tracks the time to receive the initial configuration.
	InitialLoad time.Duration

	// HTTPListeners contains received listeners with a http_connection_manager filter.
	HTTPListeners map[string]*xdsapi.Listener

	// TCPListeners contains all listeners of type TCP (not-HTTP)
	TCPListeners map[string]*xdsapi.Listener

	// All received clusters of type EDS, keyed by name
	EDSClusters map[string]*xdsapi.Cluster

	// All received clusters of no-EDS type, keyed by name
	Clusters map[string]*xdsapi.Cluster

	// All received routes, keyed by route name
	Routes map[string]*xdsapi.RouteConfiguration

	// All received endpoints, keyed by cluster name
	EDS map[string]*xdsapi.ClusterLoadAssignment

	// DumpCfg will print all received config
	DumpCfg bool

	// Metadata has the node metadata to send to pilot.
	// If nil, the defaults will be used.
	Metadata map[string]string

	// Updates includes the type of the last update received from the server.
	Updates     chan string
	VersionInfo map[string]string
	// contains filtered or unexported fields
}

ADSC implements a basic client for ADS, for use in stress tests and tools or libraries that need to connect to Istio pilot or other ADS servers.

func Dial

func Dial(url string, certDir string, opts *Config) (*ADSC, error)

Dial connects to a ADS server, with optional MTLS authentication if a cert dir is specified.

func (*ADSC) Close

func (a *ADSC) Close()

Close the stream.

func (*ADSC) EndpointsJSON

func (a *ADSC) EndpointsJSON() string

EndpointsJSON returns the endpoints, formatted as JSON, for debugging.

func (*ADSC) Run

func (a *ADSC) Run() error

Run will run the ADS client.

func (*ADSC) Save

func (a *ADSC) Save(base string) error

Save will save the json configs to files, using the base directory

func (*ADSC) Send

func (a *ADSC) Send(req *xdsapi.DiscoveryRequest) error

func (*ADSC) Wait

func (a *ADSC) Wait(update string, to time.Duration) (string, error)

Wait for an update of the specified type. If type is empty, wait for next update.

func (*ADSC) WaitClear

func (a *ADSC) WaitClear()

WaitClear will clear the waiting events, so next call to Wait will get the next push type.

func (*ADSC) Watch

func (a *ADSC) Watch()

Watch will start watching resources, starting with LDS. Based on the LDS response it will start watching RDS and CDS.

type Config

type Config struct {
	// Namespace defaults to 'default'
	Namespace string

	// Workload defaults to 'test'
	Workload string

	// Meta includes additional metadata for the node
	Meta map[string]string

	// NodeType defaults to sidecar. "ingress" and "router" are also supported.
	NodeType string

	// IP is currently the primary key used to locate inbound configs. It is sent by client,
	// must match a known endpoint IP. Tests can use a ServiceEntry to register fake IPs.
	IP string
}

Config for the ADS connection.

type Endpoint

type Endpoint struct {
	// Weight extracted from EDS
	Weight int
}

type TCPListener

type TCPListener struct {
	// Address is the address, as expected by go Dial and Listen, including port
	Address string

	// LogFile is the access log address for the listener
	LogFile string

	// Target is the destination cluster.
	Target string
}

TCPListener extracts the core elements from envoy Listener.

type Target

type Target struct {

	// Address is a go address, extracted from the mangled cluster name.
	Address string

	// Endpoints are the resolved endpoints from EDS or cluster static.
	Endpoints map[string]Endpoint
}

Jump to

Keyboard shortcuts

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