xdsc

package module
v0.0.0-...-2d719dd Latest Latest
Warning

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

Go to latest
Published: May 15, 2023 License: Apache-2.0 Imports: 27 Imported by: 0

README

Adsc fork of pilot-load fork - but without dependencies on istio.io code.

Still depends on envoy protos and grpc libraries.

This is pretty behind istio.io adsc - but most of the changes upstream are specific to istioctl functionality.

Documentation

Index

Constants

View Source
const (
	ReasonAck     = "ack"
	ReasonRequest = "request"
	ReasonInit    = "init"
)

Variables

View Source
var ErrTimeout = errors.New("timeout")

ErrTimeout is returned by Wait if no update is received in the given time.

Functions

This section is empty.

Types

type ADSC

type ADSC struct {
	GrpcOpts []grpc.DialOption

	InitialLoad bool

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

	// Responses we received last
	Responses Responses

	// Updates includes the type of the last update received from the server.
	Updates chan 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, opts *Config) (*ADSC, error)

func DialContext

func DialContext(ctx context.Context, url string, opts *Config) (*ADSC, error)

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

func DialDelta

func DialDelta(url string, opts *Config) (*ADSC, error)

func (*ADSC) Close

func (a *ADSC) Close()

Close the stream.

func (*ADSC) Connect

func (a *ADSC) Connect(pilotAddress string)

Connect dials and stays connected, retrying in case of errors.

func (*ADSC) DWatch

func (d *ADSC) DWatch()

func (*ADSC) Fetch

func (con *ADSC) Fetch() (*Responses, error)

Fetch waits for the basic responses - CDS, EDS, RDS, LDS. Watch() must be called before.

func (*ADSC) Run

func (a *ADSC) Run() error

Run will run the ADS client.

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 CDS. Based on the CDS 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]interface{}

	XDSHeaders 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

	// Context used for early cancellation
	Context context.Context

	GrpcOpts []grpc.DialOption
	NodeId   string
	Locality string
}

Config for the ADS connection.

type Endpoint

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

type ResourceKey

type ResourceKey struct {
	Name    string
	TypeUrl string
}

func (ResourceKey) String

func (k ResourceKey) String() string

type ResourceNode

type ResourceNode struct {
	Key ResourceKey

	Parents  map[*ResourceNode]struct{}
	Children map[*ResourceNode]struct{}
}

type Responses

type Responses struct {
	Clusters  map[string]proto.Message
	Listeners map[string]proto.Message
	Routes    map[string]proto.Message
	Endpoints map[string]proto.Message
}

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
}

type Watch

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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