match

package
v1.8.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BestConnectionPolicyForDestination

func BestConnectionPolicyForDestination(
	destinations []route.Destination,
	policyType model.ResourceType,
) model.Resource

BestConnectionPolicyForDestination returns the retry policy for the collection of forwarding target. This is conceptually a bit subtle because a forwarding target can have multiple destinations, each of which is a distinct service. However, there are some relatively obvious rules that we can use to determine policy.

1. If all the destinations are the same service, use that policy. 2. If there are multiple destinations, prefer a wildcard policy. 3. Everything else being equal, older policies are preferred.

func ExternalService

func ExternalService(
	services []*mesh.ExternalServiceResource,
	serviceTags mesh_proto.TagSelector,
) []*mesh.ExternalServiceResource

ExternalService selects the entries from services that match serviceTags. Note that for service matching to work correctly, both the service and the tags must have the `kuma.io/service` tag.

func Hostnames

func Hostnames(target string, matches ...string) bool

Hostnames returns true if target is a host or domain name match for any of the given matches. All the hostnames are assumed to be fully qualified (e.g. "foo.example.com") or wildcards (e.g. "*.example.com).

Two hostnames match if

1. They are exactly equal, OR 2. One of them is a domain wildcard and the domain part matches.

func OldestPolicy

func OldestPolicy(policies []model.Resource) model.Resource

OldestPolicy returns the resource that has the earliest creation time.

func Routes

Routes finds all the route resources of the given type that have a `Sources` selector that matches the given listener tags.

func ToConnectionPolicies

func ToConnectionPolicies(policies model.ResourceList) []policy.ConnectionPolicy

ToConnectionPolicies casts a ResourceList to a slice of ConnectionPolicy.

Types

type RankedPolicy

type RankedPolicy struct {
	Rank   mesh_proto.TagSelectorRank
	Policy policy.ConnectionPolicy
}

RankedPolicy is a policy that matches some set of tags, together with the rank of the match.

func ConnectionPoliciesBySource

func ConnectionPoliciesBySource(
	sourceTags map[string]string,
	policies []policy.ConnectionPolicy,
) []RankedPolicy

ConnectionPoliciesBySource finds all the connection policies that have a matching `Sources` selector. The resulting matches are not ordered.

Jump to

Keyboard shortcuts

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