clusterresolver

package
v1.60.0-dev Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Overview

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.

Index

Constants

View Source
const Name = "cluster_resolver_experimental"

Name is the name of the cluster_resolver balancer.

Variables

This section is empty.

Functions

This section is empty.

Types

type DiscoveryMechanism

type DiscoveryMechanism struct {
	// Cluster is the cluster name.
	Cluster string `json:"cluster,omitempty"`
	// LoadReportingServer is the LRS server to send load reports to. If not
	// present, load reporting will be disabled.
	LoadReportingServer *bootstrap.ServerConfig `json:"lrsLoadReportingServer,omitempty"`
	// MaxConcurrentRequests is the maximum number of outstanding requests can
	// be made to the upstream cluster. Default is 1024.
	MaxConcurrentRequests *uint32 `json:"maxConcurrentRequests,omitempty"`
	// Type is the discovery mechanism type.
	Type DiscoveryMechanismType `json:"type,omitempty"`
	// EDSServiceName is the EDS service name, as returned in CDS. May be unset
	// if not specified in CDS. For type EDS only.
	//
	// This is used for EDS watch if set. If unset, Cluster is used for EDS
	// watch.
	EDSServiceName string `json:"edsServiceName,omitempty"`
	// DNSHostname is the DNS name to resolve in "host:port" form. For type
	// LOGICAL_DNS only.
	DNSHostname string `json:"dnsHostname,omitempty"`
	// OutlierDetection is the Outlier Detection LB configuration for this
	// priority.
	OutlierDetection json.RawMessage `json:"outlierDetection,omitempty"`
	// contains filtered or unexported fields
}

DiscoveryMechanism is the discovery mechanism, can be either EDS or DNS.

For DNS, the ClientConn target will be used for name resolution.

For EDS, if EDSServiceName is not empty, it will be used for watching. If EDSServiceName is empty, Cluster will be used.

func (DiscoveryMechanism) Equal

Equal returns whether the DiscoveryMechanism is the same with the parameter.

type DiscoveryMechanismType

type DiscoveryMechanismType int

DiscoveryMechanismType is the type of discovery mechanism.

const (
	// DiscoveryMechanismTypeEDS is eds.
	DiscoveryMechanismTypeEDS DiscoveryMechanismType = iota // `json:"EDS"`
	// DiscoveryMechanismTypeLogicalDNS is DNS.
	DiscoveryMechanismTypeLogicalDNS // `json:"LOGICAL_DNS"`
)

func (DiscoveryMechanismType) MarshalJSON

func (t DiscoveryMechanismType) MarshalJSON() ([]byte, error)

MarshalJSON marshals a DiscoveryMechanismType to a quoted json string.

This is necessary to handle enum (as strings) from JSON.

Note that this needs to be defined on the type not pointer, otherwise the variables of this type will marshal to int not string.

func (*DiscoveryMechanismType) UnmarshalJSON

func (t *DiscoveryMechanismType) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals a quoted json string to the DiscoveryMechanismType.

type LBConfig

type LBConfig struct {
	serviceconfig.LoadBalancingConfig `json:"-"`
	// DiscoveryMechanisms is an ordered list of discovery mechanisms.
	//
	// Must have at least one element. Results from each discovery mechanism are
	// concatenated together in successive priorities.
	DiscoveryMechanisms []DiscoveryMechanism `json:"discoveryMechanisms,omitempty"`

	// XDSLBPolicy specifies the policy for locality picking and endpoint picking.
	XDSLBPolicy json.RawMessage `json:"xdsLbPolicy,omitempty"`
	// contains filtered or unexported fields
}

LBConfig is the config for cluster resolver balancer.

Jump to

Keyboard shortcuts

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