util

package
v0.0.0-...-519b562 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2019 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BlackHoleCluster to catch traffic from routes with unresolved clusters. Traffic arriving here goes nowhere.
	BlackHoleCluster = "BlackHoleCluster"
	// PassthroughCluster to forward traffic to the original destination requested. This cluster is used when
	// traffic does not match any listener in envoy.
	PassthroughCluster = "PassthroughCluster"
	// SniClusterFilter is the name of the sni_cluster envoy filter
	SniClusterFilter = "envoy.filters.network.sni_cluster"
	// NoProxyLocality represents the locality associated with a proxy that doesn't have locality settings
	// since all our localities are in region/zone/subzone format, the empty locality will be of form
	// '///'
	NoProxyLocality = "///"
	// IstioMetadataKey is the key under which metadata is added to a route or cluster
	// regarding the virtual service or destination rule used for each
	IstioMetadataKey = "istio"
)

Variables

View Source
var ALPNH2Only = []string{"h2"}

ALPNH2Only advertises that Proxy is going to use HTTP/2 when talking to the cluster.

View Source
var ALPNHttp = []string{"h2", "http/1.1"}

ALPNHttp advertises that Proxy is going to talking either http2 or http 1.1.

View Source
var ALPNInMesh = []string{"istio"}

ALPNInMesh advertises that Proxy is going to talk to the in-mesh cluster. The custom "istio" value indicates in-mesh traffic and it's going to be used for routing decisions.

View Source
var ALPNInMeshH2 = []string{"istio", "h2"}

ALPNInMeshH2 advertises that Proxy is going to use HTTP/2 when talking to the in-mesh cluster. The custom "istio" value indicates in-mesh traffic and it's going to be used for routing decisions. Once Envoy supports client-side ALPN negotiation, this should be {"istio", "h2", "http/1.1"}.

Functions

func BuildAddress

func BuildAddress(bind string, port uint32) core.Address

BuildAddress returns a SocketAddress with the given ip and port or uds.

func BuildConfigInfoMetadata

func BuildConfigInfoMetadata(config model.ConfigMeta) *core.Metadata

BuildConfigInfoMetadata builds core.Metadata struct containing the name.namespace of the config, the type, etc. Used by Mixer client to generate attributes for policy and telemetry.

func CloneCluster

func CloneCluster(cluster *xdsapi.Cluster) xdsapi.Cluster

return a shallow copy cluster

func CloneClusterLoadAssignment

func CloneClusterLoadAssignment(original *xdsapi.ClusterLoadAssignment) xdsapi.ClusterLoadAssignment

return a shallow copy ClusterLoadAssignment

func ConvertAddressToCidr

func ConvertAddressToCidr(addr string) *core.CidrRange

ConvertAddressToCidr converts from string to CIDR proto

func ConvertLocality

func ConvertLocality(locality string) *core.Locality

ConvertLocality converts '/' separated locality string to Locality struct.

func GetByAddress

func GetByAddress(listeners []*xdsapi.Listener, addr string) *xdsapi.Listener

GetByAddress returns a listener by its address TODO(mostrowski): consider passing map around to save iteration.

func GetNetworkEndpointAddress

func GetNetworkEndpointAddress(n *model.NetworkEndpoint) core.Address

GetNetworkEndpointAddress returns an Envoy v2 API `Address` that represents this NetworkEndpoint

func GogoDurationToDuration

func GogoDurationToDuration(d *types.Duration) time.Duration

GogoDurationToDuration converts from gogo proto duration to time.duration

func IsHTTPFilterChain

func IsHTTPFilterChain(filterChain listener.FilterChain) bool

IsHTTPFilterChain returns true if the filter chain contains a HTTP connection manager filter

func IsLocalityEmpty

func IsLocalityEmpty(locality *core.Locality) bool

IsLocalityEmpty checks if a locality is empty (checking region is good enough, based on how its initialized)

func IsProxyVersionGE11

func IsProxyVersionGE11(node *model.Proxy) bool

IsProxyVersionGE11 checks whether the given Proxy version is greater than or equals 1.1.

func IsXDSMarshalingToAnyEnabled

func IsXDSMarshalingToAnyEnabled(node *model.Proxy) bool

IsXDSMarshalingToAnyEnabled controls whether "marshaling to Any" feature is enabled.

func LbPriority

func LbPriority(proxyLocality, endpointsLocality *core.Locality) int

func LocalityLbWeightNormalize

func LocalityLbWeightNormalize(endpoints []endpoint.LocalityLbEndpoints) []endpoint.LocalityLbEndpoints

LocalityLbWeightNormalize set LocalityLbEndpoints within a cluster with a valid LoadBalancingWeight.

func LocalityMatch

func LocalityMatch(proxyLocality *core.Locality, ruleLocality string) bool

func MessageToAny

func MessageToAny(msg proto.Message) *types.Any

MessageToAny converts from proto message to proto Any

func MessageToStruct

func MessageToStruct(msg proto.Message) *types.Struct

MessageToStruct converts from proto message to proto Struct

func ResolveHostsInNetworksConfig

func ResolveHostsInNetworksConfig(config *meshconfig.MeshNetworks)

ResolveHostsInNetworksConfig will go through the Gateways addresses for all networks in the config and if it's not an IP address it will try to lookup that hostname and replace it with the IP address in the config

func SortVirtualHosts

func SortVirtualHosts(hosts []route.VirtualHost)

SortVirtualHosts sorts a slice of virtual hosts by name.

Envoy computes a hash of RDS to see if things have changed - hash is affected by order of elements in the filter. Therefore we sort virtual hosts by name before handing them back so the ordering is stable across HTTP Route Configs.

func SplitLocality

func SplitLocality(locality string) (region, zone, subzone string)

Types

This section is empty.

Jump to

Keyboard shortcuts

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