Documentation
¶
Overview ¶
SPDX-License-Identifier: Apache-2.0 Copyright Authors of Cilium
Index ¶
- Variables
- type BackoffParams
- type Client
- type Config
- type ConnectionOptions
- type DialOptionsProvider
- type NodeProvider
- type WatcherCallback
- type XDSClient
- func (c *XDSClient[ReqT, RespT]) AddResourceWatcher(typeUrl string, cb WatcherCallback) func()
- func (c *XDSClient[ReqT, RespT]) Observe(ctx context.Context, typeUrl string, resourceNames []string) error
- func (c *XDSClient[ReqT, RespT]) Run(ctx context.Context, node *corepb.Node, conn grpc.ClientConnInterface) error
Constants ¶
This section is empty.
Variables ¶
var Cell = cell.Module( "xds-client", "Client library handling xds DiscoveryRequests with gRPC transport protocol", cell.Provide(newConnectionOptions), cell.Provide(newXDSClient), cell.Invoke(runXDSClient), cell.Config(defaultConfig), )
Cell defines a new module for xDS client. Cell requires providing: * DialOptionsProvider for configuring Dial Options for gRPC connection. * NodeProvider for building xds Node
var Defaults = ConnectionOptions{ RetryBackoff: BackoffParams{ Min: time.Second, Max: time.Minute, Reset: 2 * time.Minute, }, IsRetriable: func(code codes.Code) bool { switch code { case codes.PermissionDenied, codes.Aborted, codes.Unauthenticated, codes.Unavailable, codes.Canceled: return false } return true }, }
Functions ¶
This section is empty.
Types ¶
type BackoffParams ¶
type Client ¶
type Client interface {
// Observe adds resources of given type url and names to the attention set
// of the client.
Observe(ctx context.Context, typeUrl string, resourceNames []string) error
// AddResourceWatcher registers a callback cb that will be invoked every
// time a resource with given type url changes. Function returns a callback
// to deregister the watcher.
AddResourceWatcher(typeUrl string, cb WatcherCallback) func()
// Run initialize the node and start an AggregatedDiscoverService stream.
// Requests and responses are processed until provided Context ctx is
// done or non-retriable error occurs.
Run(ctx context.Context, node *corepb.Node, conn grpc.ClientConnInterface) error
}
Client is the public interface of xDS client.
type Config ¶
type ConnectionOptions ¶
type ConnectionOptions struct {
RetryBackoff BackoffParams
RetryConnection bool
IsRetriable func(code codes.Code) (retry bool)
}
type DialOptionsProvider ¶
type DialOptionsProvider interface {
GRPCOptions(context.Context) ([]grpc.DialOption, error)
}
func NewInsecureGRPCOptionsProvider ¶
func NewInsecureGRPCOptionsProvider() DialOptionsProvider
NewInsecureGRPCOptionsProvider creates dial options provider for insecure GRPC connections.
type NodeProvider ¶
func NewDefaultNodeProvider ¶
func NewDefaultNodeProvider() NodeProvider
NewDefaultNodeProvider creates node provider for building default xds Node.
type WatcherCallback ¶
type WatcherCallback func(res *xds.VersionedResources)
WatcherCallback will be called when a new version of a resource it was registered on appears. res will contain all resources of this type.
type XDSClient ¶
type XDSClient[ReqT requestConstraint, RespT responseConstraint] struct {
// contains filtered or unexported fields
}
XDSClient is a common part of xDS gRPC client implementation using flavour to implement xDS protocol version specific behaviors.
func (*XDSClient[ReqT, RespT]) AddResourceWatcher ¶
func (c *XDSClient[ReqT, RespT]) AddResourceWatcher(typeUrl string, cb WatcherCallback) func()
func (*XDSClient[ReqT, RespT]) Observe ¶
func (c *XDSClient[ReqT, RespT]) Observe(ctx context.Context, typeUrl string, resourceNames []string) error
Observe adds resourceNames to watched resources of a given typeUrl. It will be sent to a server asynchronously.
func (*XDSClient[ReqT, RespT]) Run ¶
func (c *XDSClient[ReqT, RespT]) Run(ctx context.Context, node *corepb.Node, conn grpc.ClientConnInterface) error
Run initialize the node and start an AggregatedDiscoverService stream. Then requests and responses are processed until provided Context ctx is done or non-retriable error occurs.