xds

package
v1.68.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: Apache-2.0 Imports: 31 Imported by: 135

Documentation

Overview

Package xds contains an implementation of the xDS suite of protocols, to be used by gRPC client and server applications.

On the client-side, users simply need to import this package to get all xDS functionality. On the server-side, users need to use the GRPCServer type exported by this package instead of the regular grpc.Server.

See https://github.com/grpc/grpc-go/tree/master/examples/features/xds for example.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BootstrapContentsForTesting added in v1.39.0

func BootstrapContentsForTesting(contents []byte) grpc.ServerOption

BootstrapContentsForTesting returns a grpc.ServerOption which allows users to inject a bootstrap configuration used by only this server, instead of the global configuration from the environment variables.

Testing Only

This function should ONLY be used for testing and may not work with some other features, including the CSDS service.

Experimental

Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.

func NewXDSResolverWithConfigForTesting added in v1.39.0

func NewXDSResolverWithConfigForTesting(bootstrapConfig []byte) (resolver.Builder, error)

NewXDSResolverWithConfigForTesting creates a new xDS resolver builder using the provided xDS bootstrap config instead of the global configuration from the supported environment variables. The resolver.Builder is meant to be used in conjunction with the grpc.WithResolvers DialOption.

Testing Only

This function should ONLY be used for testing and may not work with some other features, including the CSDS service.

Experimental

Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.

func ServingModeCallback added in v1.38.0

func ServingModeCallback(cb ServingModeCallbackFunc) grpc.ServerOption

ServingModeCallback returns a grpc.ServerOption which allows users to register a callback to get notified about serving mode changes.

Types

type GRPCServer

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

GRPCServer wraps a gRPC server and provides server-side xDS functionality, by communication with a management server using xDS APIs. It implements the grpc.ServiceRegistrar interface and can be passed to service registration functions in IDL generated code.

func NewGRPCServer

func NewGRPCServer(opts ...grpc.ServerOption) (*GRPCServer, error)

NewGRPCServer creates an xDS-enabled gRPC server using the passed in opts. The underlying gRPC server has no service registered and has not started to accept requests yet.

func (*GRPCServer) GetServiceInfo added in v1.39.0

func (s *GRPCServer) GetServiceInfo() map[string]grpc.ServiceInfo

GetServiceInfo returns a map from service names to ServiceInfo. Service names include the package names, in the form of <package>.<service>.

func (*GRPCServer) GracefulStop

func (s *GRPCServer) GracefulStop()

GracefulStop stops the underlying gRPC server gracefully. It stops the server from accepting new connections and RPCs and blocks until all the pending RPCs are finished.

func (*GRPCServer) RegisterService

func (s *GRPCServer) RegisterService(sd *grpc.ServiceDesc, ss any)

RegisterService registers a service and its implementation to the underlying gRPC server. It is called from the IDL generated code. This must be called before invoking Serve.

func (*GRPCServer) Serve

func (s *GRPCServer) Serve(lis net.Listener) error

Serve gets the underlying gRPC server to accept incoming connections on the listener lis, which is expected to be listening on a TCP port.

A connection to the management server, to receive xDS configuration, is initiated here.

Serve will return a non-nil error unless Stop or GracefulStop is called.

func (*GRPCServer) Stop

func (s *GRPCServer) Stop()

Stop stops the underlying gRPC server. It immediately closes all open connections. It cancels all active RPCs on the server side and the corresponding pending RPCs on the client side will get notified by connection errors.

type ServingModeCallbackFunc added in v1.38.0

type ServingModeCallbackFunc func(addr net.Addr, args ServingModeChangeArgs)

ServingModeCallbackFunc is the callback that users can register to get notified about the server's serving mode changes. The callback is invoked with the address of the listener and its new mode.

Users must not perform any blocking operations in this callback.

type ServingModeChangeArgs added in v1.38.0

type ServingModeChangeArgs struct {
	// Mode is the new serving mode of the server listener.
	Mode connectivity.ServingMode
	// Err is set to a non-nil error if the server has transitioned into
	// not-serving mode.
	Err error
}

ServingModeChangeArgs wraps the arguments passed to the serving mode callback function.

Directories

Path Synopsis
Package bootstrap provides the functionality to register possible options for aspects of the xDS client through the bootstrap file.
Package bootstrap provides the functionality to register possible options for aspects of the xDS client through the bootstrap file.
Package csds implements features to dump the status (xDS responses) the xds_client is using.
Package csds implements features to dump the status (xDS responses) the xds_client is using.
Package googledirectpath implements a resolver that configures xds to make cloud to prod directpath connection.
Package googledirectpath implements a resolver that configures xds to make cloud to prod directpath connection.
Package internal contains functions/structs shared by xds balancers/resolvers.
Package internal contains functions/structs shared by xds balancers/resolvers.
balancer
Package balancer installs all the xds balancers.
Package balancer installs all the xds balancers.
balancer/cdsbalancer
Package cdsbalancer implements a balancer to handle CDS responses.
Package cdsbalancer implements a balancer to handle CDS responses.
balancer/clusterimpl
Package clusterimpl implements the xds_cluster_impl balancing policy.
Package clusterimpl implements the xds_cluster_impl balancing policy.
balancer/clustermanager
Package clustermanager implements the cluster manager LB policy for xds.
Package clustermanager implements the cluster manager LB policy for xds.
balancer/clusterresolver
Package clusterresolver contains the implementation of the cluster_resolver_experimental LB policy which resolves endpoint addresses using a list of one or more discovery mechanisms.
Package clusterresolver contains the implementation of the cluster_resolver_experimental LB policy which resolves endpoint addresses using a list of one or more discovery mechanisms.
balancer/loadstore
Package loadstore contains the loadStoreWrapper shared by the balancers.
Package loadstore contains the loadStoreWrapper shared by the balancers.
balancer/outlierdetection
Package outlierdetection provides an implementation of the outlier detection LB policy, as defined in https://github.com/grpc/proposal/blob/master/A50-xds-outlier-detection.md.
Package outlierdetection provides an implementation of the outlier detection LB policy, as defined in https://github.com/grpc/proposal/blob/master/A50-xds-outlier-detection.md.
balancer/priority
Package priority implements the priority balancer.
Package priority implements the priority balancer.
balancer/ringhash
Package ringhash implements the ringhash balancer.
Package ringhash implements the ringhash balancer.
balancer/wrrlocality
Package wrrlocality provides an implementation of the wrr locality LB policy, as defined in [A52 - xDS Custom LB Policies].
Package wrrlocality provides an implementation of the wrr locality LB policy, as defined in [A52 - xDS Custom LB Policies].
clusterspecifier
Package clusterspecifier contains the ClusterSpecifier interface and a registry for storing and retrieving their implementations.
Package clusterspecifier contains the ClusterSpecifier interface and a registry for storing and retrieving their implementations.
clusterspecifier/rls
Package rls implements the RLS cluster specifier plugin.
Package rls implements the RLS cluster specifier plugin.
httpfilter
Package httpfilter contains the HTTPFilter interface and a registry for storing and retrieving their implementations.
Package httpfilter contains the HTTPFilter interface and a registry for storing and retrieving their implementations.
httpfilter/fault
Package fault implements the Envoy Fault Injection HTTP filter.
Package fault implements the Envoy Fault Injection HTTP filter.
httpfilter/rbac
Package rbac implements the Envoy RBAC HTTP filter.
Package rbac implements the Envoy RBAC HTTP filter.
httpfilter/router
Package router implements the Envoy Router HTTP filter.
Package router implements the Envoy Router HTTP filter.
resolver
Package resolver implements the xds resolver, that does LDS and RDS to find the cluster to use.
Package resolver implements the xds resolver, that does LDS and RDS to find the cluster to use.
resolver/internal
Package internal contains functionality internal to the xDS resolver.
Package internal contains functionality internal to the xDS resolver.
server
Package server contains internal server-side functionality used by the public facing xds package.
Package server contains internal server-side functionality used by the public facing xds package.
test/e2e
Package e2e implements xds e2e tests using go-control-plane.
Package e2e implements xds e2e tests using go-control-plane.
testutils
Package testutils provides utility types, for use in xds tests.
Package testutils provides utility types, for use in xds tests.
testutils/fakeclient
Package fakeclient provides a fake implementation of an xDS client.
Package fakeclient provides a fake implementation of an xDS client.
xdsclient
Package xdsclient implements a full fledged gRPC client for the xDS API used by the xds resolver and balancer implementations.
Package xdsclient implements a full fledged gRPC client for the xDS API used by the xds resolver and balancer implementations.
xdsclient/internal
Package internal contains functionality internal to the xdsclient package.
Package internal contains functionality internal to the xdsclient package.
xdsclient/load
Package load provides functionality to record and maintain load data.
Package load provides functionality to record and maintain load data.
xdsclient/transport
Package transport implements the xDS transport protocol functionality required by the xdsclient.
Package transport implements the xDS transport protocol functionality required by the xdsclient.
xdsclient/transport/internal
Package internal contains functionality internal to the transport package.
Package internal contains functionality internal to the transport package.
xdsclient/xdslbregistry
Package xdslbregistry provides a registry of converters that convert proto from load balancing configuration, defined by the xDS API spec, to JSON load balancing configuration.
Package xdslbregistry provides a registry of converters that convert proto from load balancing configuration, defined by the xDS API spec, to JSON load balancing configuration.
xdsclient/xdslbregistry/converter
Package converter provides converters to convert proto load balancing configuration, defined by the xDS API spec, to JSON load balancing configuration.
Package converter provides converters to convert proto load balancing configuration, defined by the xDS API spec, to JSON load balancing configuration.
xdsclient/xdsresource
Package xdsresource implements the xDS data model layer.
Package xdsresource implements the xDS data model layer.
xdsclient/xdsresource/version
Package version defines constants to distinguish between supported xDS API versions.
Package version defines constants to distinguish between supported xDS API versions.

Jump to

Keyboard shortcuts

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