istio: Index | Files | Directories

package route

import ""


Package Files



const (
    HeaderMethod    = ":method"
    HeaderAuthority = ":authority"
    HeaderScheme    = ":scheme"

Headers with special meaning in Envoy

const DefaultRouteName = "default"

DefaultRouteName is the name assigned to a route generated by default in absence of a virtual service.

func BuildDefaultHTTPInboundRoute Uses

func BuildDefaultHTTPInboundRoute(node *model.Proxy, clusterName string, operation string) *route.Route

BuildDefaultHTTPInboundRoute builds a default inbound route.

func BuildDefaultHTTPOutboundRoute Uses

func BuildDefaultHTTPOutboundRoute(node *model.Proxy, clusterName string, operation string) *route.Route

BuildDefaultHTTPOutboundRoute builds a default outbound route, including a retry policy.

func BuildHTTPRoutesForVirtualService Uses

func BuildHTTPRoutesForVirtualService(
    node *model.Proxy,
    push *model.PushContext,
    virtualService config.Config,
    serviceRegistry map[host.Name]*model.Service,
    listenPort int,
    gatewayNames map[string]bool) ([]*route.Route, error)

BuildHTTPRoutesForVirtualService creates data plane HTTP routes from the virtual service spec. The rule should be adapted to destination names (outbound clusters). Each rule is guarded by source labels.

This is called for each port to compute virtual hosts. Each VirtualService is tried, with a list of services that listen on the port. Error indicates the given virtualService can't be used on the port. This function is used by both the gateway and the sidecar

func CombineVHostRoutes Uses

func CombineVHostRoutes(routeSets ...[]*route.Route) []*route.Route

CombineVHostRoutes semi concatenates Vhost's routes into a single route set. Moves the catch all routes alone to the end, while retaining the relative order of other routes in the concatenated route. Assumes that the virtual services that generated first and second are ordered by time.

func GetDestinationCluster Uses

func GetDestinationCluster(destination *networking.Destination, service *model.Service, listenerPort int) string

GetDestinationCluster generates a cluster name for the route, or error if no cluster can be found. Called by translateRule to determine if

type SortHeaderValueOption Uses

type SortHeaderValueOption []*core.HeaderValueOption

SortHeaderValueOption type and the functions below (Len, Less and Swap) are for sort.Stable for type HeaderValueOption

func (SortHeaderValueOption) Len Uses

func (b SortHeaderValueOption) Len() int

Len is i the sort.Interface for SortHeaderValueOption

func (SortHeaderValueOption) Less Uses

func (b SortHeaderValueOption) Less(i, j int) bool

Less is in the sort.Interface for SortHeaderValueOption

func (SortHeaderValueOption) Swap Uses

func (b SortHeaderValueOption) Swap(i, j int)

Swap is in the sort.Interface for SortHeaderValueOption

type VirtualHostWrapper Uses

type VirtualHostWrapper struct {
    // Port is the listener port for outbound sidecar (e.g. service port)
    Port int

    // Services are the services from the registry. Each service
    // in this list should have a virtual host entry
    Services []*model.Service

    // VirtualServiceHosts is a list of hosts defined in the virtual service
    // if virtual service hostname is same as a the service registry host, then
    // the host would appear in Services as we need to generate all variants of the
    // service's hostname within a platform (e.g., foo, foo.default, foo.default.svc, etc.)
    VirtualServiceHosts []string

    // Routes in the virtual host
    Routes []*route.Route

VirtualHostWrapper is a context-dependent virtual host entry with guarded routes. Note: Currently we are not fully utilizing this structure. We could invoke this logic once for all sidecars in the cluster to compute all RDS for inside the mesh and arrange it by listener port. However to properly use such an optimization, we need to have an eventing subsystem to invalidate the computed routes if any service changes/virtual services change.

func BuildSidecarVirtualHostsFromConfigAndRegistry Uses

func BuildSidecarVirtualHostsFromConfigAndRegistry(node *model.Proxy, push *model.PushContext, serviceRegistry map[host.Name]*model.Service,
    virtualServices []config.Config, listenPort int) []VirtualHostWrapper

BuildSidecarVirtualHostsFromConfigAndRegistry creates virtual hosts from the given set of virtual services and a list of services from the service registry. Services are indexed by FQDN hostnames. The list of services is also passed to allow maintaining consistent ordering.



Package route imports 26 packages (graph) and is imported by 2 packages. Updated 2021-01-12. Refresh now. Tools for package owners.