istio: istio.io/istio/pilot/pkg/networking/util Index | Files

package util

import "istio.io/istio/pilot/pkg/networking/util"

Index

Package Files

util.go

Constants

const (
    // BlackHoleCluster to catch traffic from routes with unresolved clusters. Traffic arriving here goes nowhere.
    BlackHoleCluster = "BlackHoleCluster"
    // BlackHoleRouteName is the name of the route that blocks all traffic.
    BlackHoleRouteName = "block_all"
    // PassthroughCluster to forward traffic to the original destination requested. This cluster is used when
    // traffic does not match any listener in envoy.
    PassthroughCluster = "PassthroughCluster"
    // PassthroughRouteName is the name of the route that forwards traffic to the
    // PassthroughCluster
    PassthroughRouteName = "allow_any"

    // Inbound pass through cluster need to the bind the loopback ip address for the security and loop avoidance.
    InboundPassthroughClusterIpv4 = "InboundPassthroughClusterIpv4"
    InboundPassthroughClusterIpv6 = "InboundPassthroughClusterIpv6"
    // 6 is the magical number for inbound: 15006, 127.0.0.6, ::6
    InboundPassthroughBindIpv4 = "127.0.0.6"
    InboundPassthroughBindIpv6 = "::6"

    // SniClusterFilter is the name of the sni_cluster envoy filter
    SniClusterFilter = "envoy.filters.network.sni_cluster"
    // ForwardDownstreamSniFilter forwards the sni from downstream connections to upstream
    // Used only in the fallthrough filter stack for TLS connections
    ForwardDownstreamSniFilter = "forward_downstream_sni"
    // 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"

    // EnvoyTransportSocketMetadataKey is the key under which metadata is added to an endpoint
    // which determines the endpoint level transport socket configuration.
    EnvoyTransportSocketMetadataKey = "envoy.transport_socket_match"

    // EnvoyRawBufferSocketName matched with hardcoded built-in Envoy transport name which determines
    // endpoint level plantext transport socket configuration
    EnvoyRawBufferSocketName = "envoy.transport_sockets.raw_buffer"

    // EnvoyTLSSocketName matched with hardcoded built-in Envoy transport name which determines endpoint
    // level tls transport socket configuration
    EnvoyTLSSocketName = "envoy.transport_sockets.tls"
)

Variables

var ALPNDownstream = []string{"istio-peer-exchange", "h2", "http/1.1"}

ALPNDownstream advertises that Proxy is going to talking either tcp(for metadata exchange), http2 or http 1.1.

var ALPNH2Only = []string{"h2"}

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

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

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

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.

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"}.

var ALPNInMeshWithMxc = []string{"istio-peer-exchange", "istio"}

ALPNInMeshWithMxc advertises that Proxy is going to talk to the in-mesh cluster and has metadata exchange enabled for TCP. The custom "istio-peer-exchange" value indicates, metadata exchange is enabled for TCP. The custom "istio" value indicates in-mesh traffic and it's going to be used for routing decisions.

var FallThroughFilterChainBlackHoleService = &model.Service{
    Hostname: host.Name(BlackHoleCluster),
    Attributes: model.ServiceAttributes{
        Name: BlackHoleCluster,
    },
}

FallThroughFilterChainBlackHoleService is the blackhole service used for fall though filter chain

var FallThroughFilterChainPassthroughService = &model.Service{
    Hostname: host.Name(PassthroughCluster),
    Attributes: model.ServiceAttributes{
        Name: PassthroughCluster,
    },
}

FallThroughFilterChainPassthroughService is the passthrough service used for fall though

func ApplyCustomSDSToCommonTLSContext Uses

func ApplyCustomSDSToCommonTLSContext(tlsContext *envoyauth.CommonTlsContext, tlsOpts *networking.Server_TLSOptions, sdsUdsPath string)

ApplyCustomSDSToCommonTLSContext applies the customized sds to CommonTlsContext Used for building both gateway/sidecar TLS context

func ApplyToCommonTLSContext Uses

func ApplyToCommonTLSContext(tlsContext *envoyauth.CommonTlsContext, metadata *model.NodeMetadata, sdsPath string, subjectAltNames []string)

ApplyToCommonTLSContext completes the commonTlsContext for `ISTIO_MUTUAL` TLS mode

func BuildAddress Uses

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

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

func BuildConfigInfoMetadata Uses

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 BuildLbEndpointMetadata Uses

func BuildLbEndpointMetadata(uid string, network string, tlsMode string, push *model.PushContext) *core.Metadata

BuildLbEndpointMetadata adds metadata values to a lb endpoint

func BuildStatPrefix Uses

func BuildStatPrefix(statPattern string, host string, subset string, port *model.Port, attributes model.ServiceAttributes) string

BuildStatPrefix builds a stat prefix based on the stat pattern.

func CloneCluster Uses

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

return a shallow copy cluster

func CloneClusterLoadAssignment Uses

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

return a shallow copy ClusterLoadAssignment

func ConvertAddressToCidr Uses

func ConvertAddressToCidr(addr string) *core.CidrRange

ConvertAddressToCidr converts from string to CIDR proto

func ConvertLocality Uses

func ConvertLocality(locality string) *core.Locality

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

func GogoDurationToDuration Uses

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

GogoDurationToDuration converts from gogo proto duration to time.duration

func IsAllowAnyOutbound Uses

func IsAllowAnyOutbound(node *model.Proxy) bool

IsAllowAnyOutbound checks if allow_any is enabled for outbound traffic

func IsHTTPFilterChain Uses

func IsHTTPFilterChain(filterChain *listener.FilterChain) bool

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

func IsIstioVersionGE13 Uses

func IsIstioVersionGE13(node *model.Proxy) bool

IsIstioVersionGE13 checks whether the given Istio version is greater than or equals 1.3.

func IsIstioVersionGE14 Uses

func IsIstioVersionGE14(node *model.Proxy) bool

IsIstioVersionGE14 checks whether the given Istio version is greater than or equals 1.4.

func IsIstioVersionGE15 Uses

func IsIstioVersionGE15(node *model.Proxy) bool

IsIstioVersionGE15 checks whether the given Istio version is greater than or equals 1.5.

func IsLocalityEmpty Uses

func IsLocalityEmpty(locality *core.Locality) bool

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

func IsProtocolSniffingEnabledForInbound Uses

func IsProtocolSniffingEnabledForInbound(node *model.Proxy) bool

func IsProtocolSniffingEnabledForInboundPort Uses

func IsProtocolSniffingEnabledForInboundPort(node *model.Proxy, port *model.Port) bool

func IsProtocolSniffingEnabledForOutbound Uses

func IsProtocolSniffingEnabledForOutbound(node *model.Proxy) bool

IsProtocolSniffingEnabled checks whether protocol sniffing is enabled.

func IsProtocolSniffingEnabledForOutboundPort Uses

func IsProtocolSniffingEnabledForOutboundPort(node *model.Proxy, port *model.Port) bool

func IsProtocolSniffingEnabledForPort Uses

func IsProtocolSniffingEnabledForPort(node *model.Proxy, port *model.Port) bool

func IsTCPMetadataExchangeEnabled Uses

func IsTCPMetadataExchangeEnabled(node *model.Proxy) bool

IsTCPMetadataExchangeEnabled checks whether Metadata Exchanged enabled for TCP using ALPN.

func LbPriority Uses

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

func LocalityMatch Uses

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

func LocalityToString Uses

func LocalityToString(l *core.Locality) string

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

func MergeAnyWithAny Uses

func MergeAnyWithAny(dst *any.Any, src *any.Any) (*any.Any, error)

MergeAnyWithAny merges a given any typed message into the given Any typed message by dynamically inferring the type of Any

func MergeAnyWithStruct Uses

func MergeAnyWithStruct(a *any.Any, pbStruct *pstruct.Struct) (*any.Any, error)

MergeAnyWithStruct merges a given struct into the given Any typed message by dynamically inferring the type of Any, converting the struct into the inferred type, merging the two messages, and then marshaling the merged message back into Any.

func MessageToAny Uses

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

MessageToAny converts from proto message to proto Any

func MessageToAnyWithError Uses

func MessageToAnyWithError(msg proto.Message) (*any.Any, error)

MessageToAnyWithError converts from proto message to proto Any

func MessageToStruct Uses

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

MessageToStruct converts from proto message to proto Struct

func SortVirtualHosts Uses

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 Uses

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

Package util imports 29 packages (graph) and is imported by 37 packages. Updated 2020-02-27. Refresh now. Tools for package owners.