xdsdepmgr

package
v1.83.2 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package xdsdepmgr provides the implementation of the xDS dependency manager that manages all the xDS watches and resources as described in gRFC A74.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetXDSClusterSubscriber added in v1.80.0

func SetXDSClusterSubscriber(state resolver.State, subs ClusterSubscriber) resolver.State

SetXDSClusterSubscriber returns a copy of state in which the Attributes field is updated with the ClusterSubscriber interface.

Types

type ClusterSubscriber added in v1.80.0

type ClusterSubscriber interface {
	// SubscribeToCluster creates a dynamic subscription for the named cluster.
	//
	// The returned cancel function must be called when the subscription is no
	// longer needed. It is safe to call cancel multiple times.
	SubscribeToCluster(clusterName string) (cancel func())
}

ClusterSubscriber allows dynamic subscription to clusters. This is useful for scenarios where the cluster name was not present in the RouteConfiguration, e.g. when the route uses a ClusterSpecifierPlugin.

The xDS resolver will pass this interface to the LB policies as an attribute in the resolver update.

func XDSClusterSubscriberFromResolverState added in v1.80.0

func XDSClusterSubscriberFromResolverState(state resolver.State) ClusterSubscriber

XDSClusterSubscriberFromResolverState returns ClusterSubscriber interface stored as an attribute in the resolver state.

type ConfigWatcher

type ConfigWatcher interface {
	// Update is invoked when a new, validated xDS configuration is available.
	//
	// Implementations must treat the received config as read-only and should
	// not modify it.
	Update(*xdsresource.XDSConfig)

	// Error is invoked when an error is received from the listener or route
	// resource watcher. This includes cases where:
	//  - The listener or route resource watcher reports a resource error.
	//  - The received listener resource is a socket listener, not an API
	//    listener. TODO(i/8114): Implement this check.
	//  - The received route configuration does not contain a virtual host
	//    matching the channel's default authority.
	Error(error)
}

ConfigWatcher is the interface for consumers of aggregated xDS configuration from the DependencyManager. The only consumer of this configuration is currently the xDS resolver.

type DependencyManager

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

DependencyManager registers watches on the xDS client for all required xDS resources, resolves dependencies between them, and returns a complete configuration to the xDS resolver.

func New

func New(listenerName, dataplaneAuthority string, xdsClient xdsclient.XDSClient, watcher ConfigWatcher) *DependencyManager

New creates a new DependencyManager.

  • listenerName is the name of the Listener resource to request from the management server.
  • dataplaneAuthority is used to select the best matching virtual host from the route configuration received from the management server.
  • xdsClient is the xDS client to use to register resource watches.
  • watcher is the ConfigWatcher interface that will receive the aggregated XDSConfig updates and errors.

func (*DependencyManager) Close

func (m *DependencyManager) Close()

Close cancels all registered resource watches.

func (*DependencyManager) RequestDNSReresolution added in v1.79.0

func (m *DependencyManager) RequestDNSReresolution(opt resolver.ResolveNowOptions)

RequestDNSReresolution calls all the DNS resolver's ResolveNow.

func (*DependencyManager) SubscribeToCluster added in v1.80.0

func (m *DependencyManager) SubscribeToCluster(name string) func()

SubscribeToCluster increments the reference count for the cluster. If the cluster is not already being tracked, it is added to the clusterSubscriptions map. It returns a function to unsubscribe from the cluster i.e. decrease its refcount. This returned function is idempotent, meaning it can be called multiple times without any additional effect. Calling Subscribe in a blocking manner while handling an update will lead to a deadlock.

Jump to

Keyboard shortcuts

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