xds

package
v0.0.0-...-83c1a15 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Supported Envoy node metadata fields.
	FieldDataplaneAdminPort         = "dataplane.admin.port"
	FieldDataplaneAdminAddress      = "dataplane.admin.address"
	FieldDataplaneDNSPort           = "dataplane.dns.port"
	FieldDataplaneDNSEmptyPort      = "dataplane.dns.empty.port"
	FieldDataplaneDataplaneResource = "dataplane.resource"
	FieldDynamicMetadata            = "dynamicMetadata"
	FieldDataplaneProxyType         = "dataplane.proxyType"
	FieldPrefixDependenciesVersion  = "version.dependencies"
	FieldVersion                    = "version"
	FieldFeatures                   = "features"
	FieldWorkdir                    = "workdir"
	FieldAccessLogSocketPath        = "accessLogSocketPath"
	FieldMetricsSocketPath          = "metricsSocketPath"
	FieldMetricsCertPath            = "metricsCertPath"
	FieldMetricsKeyPath             = "metricsKeyPath"
)
View Source
const FeatureTCPAccessLogViaNamedPipe string = "feature-tcp-accesslog-via-named-pipe"

FeatureTCPAccessLogViaNamedPipe indicates that the DP implements TCP accesslog across a named pipe. Sotw DP versions may use structured data across GRPC.

Variables

This section is empty.

Functions

func AccessLogSocketName

func AccessLogSocketName(tmpDir, name, mesh string) string

AccessLogSocketName generates a socket path that will fit the Unix socket path limitation of 104 chars

func MetricsHijackerSocketName

func MetricsHijackerSocketName(tmpDir, name, mesh string) string

MetricsHijackerSocketName generates a socket path that will fit the Unix socket path limitation of 104 chars

Types

type APIVersion

type APIVersion string

type CaRequest

type CaRequest interface {
	MeshName() []string
	Name() string
}

type DataplaneMetadata

type DataplaneMetadata struct {
	Resource            model.Resource
	AdminPort           uint32
	AdminAddress        string
	DNSPort             uint32
	EmptyDNSPort        uint32
	DynamicMetadata     map[string]string
	ProxyType           mesh_proto.ProxyType
	Features            Features
	WorkDir             string
	AccessLogSocketPath string
	MetricsSocketPath   string
	MetricsCertPath     string
	MetricsKeyPath      string
}

DataplaneMetadata represents environment-specific part of a dataplane configuration.

This information might change from one dataplane run to another, and therefore it cannot be a part of Dataplane resource.

On start-up, a dataplane captures its effective configuration (that might come from a file, environment variables and command line options) and includes it into request for a bootstrap config. Control Plane can use this information to fill in node metadata in the bootstrap config. Envoy will include node metadata from the bootstrap config at least into the very first discovery request on every xDS stream. This way, xDS server will be able to use Envoy node metadata to generate xDS resources that depend on environment-specific configuration.

func DataplaneMetadataFromXdsMetadata

func DataplaneMetadataFromXdsMetadata(xdsMetadata *structpb.Struct, tmpDir string, dpKey model.ResourceKey) *DataplaneMetadata

func (*DataplaneMetadata) GetAdminAddress

func (m *DataplaneMetadata) GetAdminAddress() string

func (*DataplaneMetadata) GetAdminPort

func (m *DataplaneMetadata) GetAdminPort() uint32

func (*DataplaneMetadata) GetDNSPort

func (m *DataplaneMetadata) GetDNSPort() uint32

func (*DataplaneMetadata) GetDataplaneResource

func (m *DataplaneMetadata) GetDataplaneResource() *core_mesh.DataplaneResource

GetDataplaneResource returns the underlying DataplaneResource, if present. If the resource is of a different type, it returns nil.

func (*DataplaneMetadata) GetDynamicMetadata

func (m *DataplaneMetadata) GetDynamicMetadata(key string) string

func (*DataplaneMetadata) GetEmptyDNSPort

func (m *DataplaneMetadata) GetEmptyDNSPort() uint32

func (*DataplaneMetadata) GetProxyType

func (m *DataplaneMetadata) GetProxyType() mesh_proto.ProxyType

func (*DataplaneMetadata) GetZoneIngressResource

func (m *DataplaneMetadata) GetZoneIngressResource() *core_mesh.ZoneIngressResource

GetZoneIngressResource returns the underlying ZoneIngressResource, if present. If the resource is of a different type, it returns nil.

type DestinationMap

type DestinationMap map[ServiceName]TagSelectorSet

DestinationMap holds a set of selectors for all reachable Dataplanes grouped by service name. DestinationMap is based on ServiceName and not on the OutboundInterface because TrafficRoute can introduce new service destinations that were not included in a outbound section. Policies that match on outbound connections also match by service destination name and not outbound interface for the same reason.

type Endpoint

type Endpoint struct {
	Target          string
	UnixDomainPath  string
	Port            uint32
	Tags            map[string]string
	Weight          uint32
	Locality        *Locality
	ExternalService *ExternalService
}

Endpoint holds routing-related information about a single endpoint.

func (Endpoint) Address

func (e Endpoint) Address() string

func (Endpoint) ContainsTags

func (e Endpoint) ContainsTags(tags map[string]string) bool

ContainsTags returns 'true' if for every key presented both in 'tags' and 'Endpoint#Tags' values are equal

func (Endpoint) HasLocality

func (e Endpoint) HasLocality() bool

func (Endpoint) IsExternalService

func (e Endpoint) IsExternalService() bool

func (Endpoint) IsReachableFromZone

func (e Endpoint) IsReachableFromZone(localZone string) bool

if false endpoint should be accessed through zoneIngress of other zone

func (Endpoint) LocalityString

func (e Endpoint) LocalityString() string

type EndpointList

type EndpointList []Endpoint

EndpointList is a list of Endpoints with convenience methods.

func (EndpointList) Filter

func (l EndpointList) Filter(selector mesh_proto.TagSelector) EndpointList

type EndpointMap

type EndpointMap map[ServiceName][]Endpoint

EndpointMap holds routing-related information about a set of endpoints grouped by service name.

type ExternalService

type ExternalService struct {
	TLSEnabled               bool
	CaCert                   []byte
	ClientCert               []byte
	ClientKey                []byte
	AllowRenegotiation       bool
	SkipHostnameVerification bool
	ServerName               string
}

type ExternalServiceDynamicPolicies

type ExternalServiceDynamicPolicies map[ServiceName]PluginOriginatedPolicies

type Features

type Features map[string]bool

Features is a set of features which a data plane has enabled.

func (Features) HasFeature

func (f Features) HasFeature(feature string) bool

HasFeature returns true iff the feature string appears in the feature list.

type IdentityCertRequest

type IdentityCertRequest interface {
	Name() string
}

type Locality

type Locality struct {
	Zone     string
	SubZone  string
	Priority uint32
	Weight   uint32
}

type MatchedPolicies

type MatchedPolicies struct {
	Dynamic PluginOriginatedPolicies
}

type MeshIngressResources

type MeshIngressResources struct {
	Mesh        *core_mesh.MeshResource
	EndpointMap EndpointMap
	Resources   map[core_model.ResourceType]core_model.ResourceList
}

type MeshName

type MeshName = string

type Proxy

type Proxy struct {
	Id         ProxyId
	APIVersion APIVersion
	Dataplane  *core_mesh.DataplaneResource
	Metadata   *DataplaneMetadata
	Routing    Routing
	Policies   MatchedPolicies

	// SecretsTracker allows us to track when a generator references a secret so
	// we can be sure to include only those secrets later on.
	SecretsTracker SecretsTracker

	// ZoneIngressProxy is available only when XDS is generated for ZoneIngress data plane proxy.
	ZoneIngressProxy *ZoneIngressProxy
	// RuntimeExtensions a set of extensions to add for custom extensions
	RuntimeExtensions map[string]interface{}
	// Zone the zone the proxy is in
	Zone string
}

Proxy contains required data for generating XDS config that is specific to a data plane proxy. The data that is specific for the whole mesh should go into MeshContext.

type ProxyId

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

func BuildProxyId

func BuildProxyId(mesh, name string) *ProxyId

func FromResourceKey

func FromResourceKey(key core_model.ResourceKey) ProxyId

func ParseProxyIdFromString

func ParseProxyIdFromString(id string) (*ProxyId, error)

func (*ProxyId) String

func (id *ProxyId) String() string

func (*ProxyId) ToResourceKey

func (id *ProxyId) ToResourceKey() core_model.ResourceKey

type Resource

type Resource struct {
	Name     string
	Origin   string
	Resource ResourcePayload
}

Resource represents a generic xDS resource with name and version.

type ResourceList

type ResourceList []*Resource

ResourceList represents a list of generic xDS resources.

func (ResourceList) Len

func (rs ResourceList) Len() int

func (ResourceList) Less

func (rs ResourceList) Less(i, j int) bool

func (ResourceList) Payloads

func (rs ResourceList) Payloads() []ResourcePayload

func (ResourceList) Swap

func (rs ResourceList) Swap(i, j int)

func (ResourceList) ToDeltaDiscoveryResponse

func (rs ResourceList) ToDeltaDiscoveryResponse() (*envoy_sd.DeltaDiscoveryResponse, error)

func (ResourceList) ToIndex

func (rs ResourceList) ToIndex() map[string]ResourcePayload

type ResourcePayload

type ResourcePayload = envoy_types.Resource

ResourcePayload is a convenience type alias.

type ResourceSet

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

ResourceSet represents a set of generic xDS resources.

func NewResourceSet

func NewResourceSet() *ResourceSet

func (*ResourceSet) Add

func (s *ResourceSet) Add(resources ...*Resource) *ResourceSet

func (*ResourceSet) AddSet

func (s *ResourceSet) AddSet(set *ResourceSet) *ResourceSet

func (*ResourceSet) Contains

func (s *ResourceSet) Contains(name string, resource ResourcePayload) bool

func (*ResourceSet) Empty

func (s *ResourceSet) Empty() bool

func (*ResourceSet) List

func (s *ResourceSet) List() ResourceList

func (*ResourceSet) ListOf

func (s *ResourceSet) ListOf(typ string) ResourceList

func (*ResourceSet) Remove

func (s *ResourceSet) Remove(typ string, name string)

func (*ResourceSet) ResourceTypes

func (s *ResourceSet) ResourceTypes() []string

ResourceTypes returns names of all the distinct resource types in the set.

func (*ResourceSet) Resources

func (s *ResourceSet) Resources(typ string) map[string]*Resource

type Routing

type Routing struct {
	OutboundTargets EndpointMap
	// ExternalServiceOutboundTargets contains endpoint map for direct access of external services (without egress)
	// Since we take into account TrafficPermission to exclude external services from the map,
	// it is specific for each data plane proxy.
	ExternalServiceOutboundTargets EndpointMap
}

type SecretsTracker

type SecretsTracker interface {
	RequestIdentityCert() IdentityCertRequest
	RequestCa(mesh string) CaRequest
	RequestAllInOneCa() CaRequest

	UsedIdentity() bool
	UsedCas() map[string]struct{}
	UsedAllInOne() bool
}

SecretsTracker provides a way to ask for a secret and keeps track of which are used, so that they can later be generated and included in the resources.

type ServerSideTLSCertPaths

type ServerSideTLSCertPaths struct {
	CertPath string
	KeyPath  string
}

type ServiceName

type ServiceName = string

ServiceName is a convenience type alias to clarify the meaning of string value.

type SocketAddressProtocol

type SocketAddressProtocol int32

SocketAddressProtocol is the L4 protocol the listener should bind to

const (
	SocketAddressProtocolTCP SocketAddressProtocol = 0
	SocketAddressProtocolUDP SocketAddressProtocol = 1
)

type StreamID

type StreamID = int64

StreamID represents a stream opened by XDS

type TagSelectorSet

type TagSelectorSet []mesh_proto.TagSelector

TagSelectorSet is a set of unique TagSelectors.

func (TagSelectorSet) Add

func (TagSelectorSet) Matches

func (s TagSelectorSet) Matches(tags map[string]string) bool

type TypedMatchingPolicies

type TypedMatchingPolicies struct {
	Type              core_model.ResourceType
	InboundPolicies   map[mesh_proto.InboundInterface][]core_model.Resource
	OutboundPolicies  map[mesh_proto.OutboundInterface][]core_model.Resource
	ServicePolicies   map[ServiceName][]core_model.Resource
	DataplanePolicies []core_model.Resource
}

TypedMatchingPolicies all policies of this type matching

type ZoneIngressProxy

type ZoneIngressProxy struct {
	ZoneIngressResource *core_mesh.ZoneIngressResource
	MeshResourceList    []*MeshIngressResources
}

Jump to

Keyboard shortcuts

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