Documentation ¶
Overview ¶
Package controller contains implementation to connect to the control plane. Including starting the ClientConn, starting the xDS stream, and sending/receiving messages.
All the messages are parsed by the resource package (e.g. UnmarshalListener()) and sent to the Pubsub watchers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetGRPCDial ¶ added in v1.45.0
func SetGRPCDial(dialer func(target string, opts ...grpc.DialOption) (*grpc.ClientConn, error))
SetGRPCDial sets the dialer for the controller. The dial can be used to manipulate the dial options or change the target if needed. The SetGRPCDial must be called before gRPC initialization to make sure it affects all the controllers created. To reset any dialer set, pass in grpc.Dial as the parameter.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller manages the connection and stream to the control plane.
It keeps track of what resources are being watched, and send new requests when new watches are added.
It takes a pubsub (as an interface) as input. When a response is received, it's parsed, and the updates are sent to the pubsub.
func New ¶
func New(config *bootstrap.ServerConfig, updateHandler pubsub.UpdateHandler, validator xdsresource.UpdateValidatorFunc, logger *grpclog.PrefixLogger, boff func(int) time.Duration) (_ *Controller, retErr error)
New creates a new controller.
func (*Controller) AddWatch ¶
func (t *Controller) AddWatch(rType xdsresource.ResourceType, resourceName string)
AddWatch adds a watch for an xDS resource given its type and name.
func (*Controller) RemoveWatch ¶
func (t *Controller) RemoveWatch(rType xdsresource.ResourceType, resourceName string)
RemoveWatch cancels an already registered watch for an xDS resource given its type and name.
func (*Controller) ReportLoad ¶
func (c *Controller) ReportLoad(server string) (*load.Store, func())
ReportLoad starts an load reporting stream to the given server. If the server is not an empty string, and is different from the management server, a new ClientConn will be created.
The same options used for creating the Client will be used (including NodeProto, and dial options if necessary).
It returns a Store for the user to report loads, a function to cancel the load reporting stream.
TODO(xdsfed): LRS refactor, delete the parameter of this function, and cleanup the multiple LRS ClientConn code. Each controller should have one ClientConn to the authority it's created for, all LRS streams (and ADS streams) in this controller should all share that ClientConn.
Directories ¶
Path | Synopsis |
---|---|
Package version defines APIs to deal with different versions of xDS.
|
Package version defines APIs to deal with different versions of xDS. |
v2
Package v2 provides xDS v2 transport protocol specific functionality.
|
Package v2 provides xDS v2 transport protocol specific functionality. |
v3
Package v3 provides xDS v3 transport protocol specific functionality.
|
Package v3 provides xDS v3 transport protocol specific functionality. |