Documentation ¶
Overview ¶
Package xds contains the client that can be used to interact with the management server to receive address updates for subscribed clusters
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client performs the actual ADS RPCs using the ADS v3 API. It creates an ADS stream on which the xdsTarget resources are received.
func (*Client) Done ¶
func (c *Client) Done() <-chan struct{}
Done returns a channel which is closed when the run loop stops due to context expiry
func (*Client) Receive ¶
func (c *Client) Receive() <-chan []*v3endpointpb.ClusterLoadAssignment
Receive returns a channel where ClusterLoadAssignment resource updates can be received
type Options ¶
type Options struct { XDSTarget string NodeProto *v3corepb.Node ClientConn grpc.ClientConnInterface BackoffStrategy backoff.Strategy Logger log.Logger }
Options specifies options to be provided for initialising the xds client
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver sends updates to via the channel returned by UpdateChan()
func NewResolver ¶
func NewResolver(rc clusterUpdateReceiver) *Resolver
NewResolver returns a *Resolver that uses rc to receive cluster updates
Example ¶
cfg, err := bootstrap.NewConfigFromContents([]byte(`{ "xds_server": { "server_uri": "localhost:9100", "node": { "id": "52fdfc07-2182-454f-963f-5f0f9a621d72", "cluster": "cluster", "metadata": { "TRAFFICDIRECTOR_GCP_PROJECT_NUMBER": "123456789012345", "TRAFFICDIRECTOR_NETWORK_NAME": "thedefault" }, "locality": { "zone": "uscentral-5" } } } }`, )) if err != nil { panic(err) } ctx, _ := signal.NotifyContext(context.Background(), os.Kill, os.Interrupt) cc, err := grpc.DialContext(ctx, cfg.XDSServer.ServerURI, grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { panic(err) } xdsClient := xds.NewClient(xds.Options{ XDSTarget: "xds:///broker.domain", NodeProto: cfg.XDSServer.NodeProto.(*corev3.Node), ClientConn: cc, BackoffStrategy: &backoff.DefaultExponential, }) if err := xdsClient.Start(ctx); err != nil { panic(err) } r := xds.NewResolver(xdsClient) c, err := courier.NewClient(courier.WithResolver(r)) if err != nil { panic(err) } if err := c.Start(); err != nil { panic(err) } <-ctx.Done()
Output:
func (*Resolver) Done ¶
func (r *Resolver) Done() <-chan struct{}
Done returns a channel which is closed when the underlying clusterUpdateReceiver is marked as done
func (*Resolver) UpdateChan ¶
func (r *Resolver) UpdateChan() <-chan []courier.TCPAddress
UpdateChan returns a channel where []courier.TCPAddress can be received
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package backoff provides exponential backoff capabilities
|
Package backoff provides exponential backoff capabilities |
Package bootstrap provides bootstrap config loading capabilities to xds client
|
Package bootstrap provides bootstrap config loading capabilities to xds client |
Package log provides logger interface for usage inside xds client
|
Package log provides logger interface for usage inside xds client |