Documentation ¶
Index ¶
- func BestConnectionPolicyForDestination(destinations []route.Destination, policyType model.ResourceType) model.Resource
- func ExternalService(services []*mesh.ExternalServiceResource, serviceTags mesh_proto.TagSelector) []*mesh.ExternalServiceResource
- func Hostnames(target string, matches ...string) bool
- func OldestPolicy(policies []model.Resource) model.Resource
- func Routes(routes []*core_mesh.MeshGatewayRouteResource, listener mesh_proto.TagSelector) []*core_mesh.MeshGatewayRouteResource
- func ToConnectionPolicies(policies model.ResourceList) []policy.ConnectionPolicy
- type RankedPolicy
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 ¶
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 ¶
OldestPolicy returns the resource that has the earliest creation time.
func Routes ¶
func Routes(routes []*core_mesh.MeshGatewayRouteResource, listener mesh_proto.TagSelector) []*core_mesh.MeshGatewayRouteResource
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.