policy

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: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MatchSelector added in v1.8.1

func MatchSelector(tags map[string]string, selectors []*mesh_proto.Selector) (mesh_proto.TagSelectorRank, bool)

MatchSelector succeeds if any of the given selectors matches the tags. It additionally returns the rank of the selector that matched the tag.

Types

type ConnectionPolicy

type ConnectionPolicy interface {
	core_model.Resource
	Sources() []*mesh_proto.Selector
	Destinations() []*mesh_proto.Selector
}

ConnectionPolicy is a Policy that is applied on a connection between two data planes that match source and destination.

func SelectInboundConnectionAllPolicies

func SelectInboundConnectionAllPolicies(inboundTags map[string]string, policies []ConnectionPolicy) []ConnectionPolicy

SelectInboundConnectionAllPolicies picks polices for given inbound tags.

func SelectInboundConnectionPolicy

func SelectInboundConnectionPolicy(inboundTags map[string]string, policies []ConnectionPolicy) ConnectionPolicy

SelectInboundConnectionPolicy picks a single the most specific policy for given inbound tags.

type ConnectionPolicyByName

type ConnectionPolicyByName []ConnectionPolicy

func (ConnectionPolicyByName) Len

func (a ConnectionPolicyByName) Len() int

func (ConnectionPolicyByName) Less

func (a ConnectionPolicyByName) Less(i, j int) bool

func (ConnectionPolicyByName) Swap

func (a ConnectionPolicyByName) Swap(i, j int)

type ConnectionPolicyBySourceRank

type ConnectionPolicyBySourceRank []ConnectionPolicy

func (ConnectionPolicyBySourceRank) Len

func (ConnectionPolicyBySourceRank) Less

func (a ConnectionPolicyBySourceRank) Less(i, j int) bool

func (ConnectionPolicyBySourceRank) Swap

func (a ConnectionPolicyBySourceRank) Swap(i, j int)

type DataplanePolicy

type DataplanePolicy interface {
	core_model.Resource
	Selectors() []*mesh_proto.Selector
}

DataplanePolicy is a Policy that is applied on a selected Dataplane

func SelectDataplanePolicy

func SelectDataplanePolicy(dataplane *mesh.DataplaneResource, policies []DataplanePolicy) DataplanePolicy

SelectDataplanePolicy given a Dataplane definition and a list of DataplanePolicy returns the "best matching" DataplanePolicy. A DataplanePolicy is considered a match if one of the inbound interfaces of a Dataplane or tag section on Gateway Dataplane has all tags of DataplanePolicy's selector. Every matching DataplanePolicy gets a rank (score) defined as a maximum number of tags in a matching selector. DataplanePolicy with an empty list of selectors is considered a match with a rank (score) of 0. DataplanePolicy with an empty selector (one that has no tags) is considered a match with a rank (score) of 0. In case if there are multiple DataplanePolicies with the same rank (score), the policy created last is chosen.

func SelectDataplanePolicyWithMatcher added in v1.8.1

func SelectDataplanePolicyWithMatcher(matches TagMatcher, policies []DataplanePolicy) DataplanePolicy

SelectDataplanePolicyWithMatcher tries to match a DataplanePolicy with the given matches function. Every matching DataplanePolicy gets a rank (score) defined as a maximum number of tags in a matching selector. DataplanePolicy with an empty list of selectors is considered a match with a rank (score) of 0. DataplanePolicy with an empty selector (one that has no tags) is considered a match with a rank (score) of 0. In case if there are multiple DataplanePolicies with the same rank (score), the policy created last is chosen.

type DataplanePolicyByName

type DataplanePolicyByName []DataplanePolicy

func (DataplanePolicyByName) Len

func (a DataplanePolicyByName) Len() int

func (DataplanePolicyByName) Less

func (a DataplanePolicyByName) Less(i, j int) bool

func (DataplanePolicyByName) Swap

func (a DataplanePolicyByName) Swap(i, j int)

type InboundConnectionPoliciesMap

type InboundConnectionPoliciesMap map[mesh_proto.InboundInterface][]ConnectionPolicy

func SelectInboundConnectionMatchingPolicies

func SelectInboundConnectionMatchingPolicies(dataplane *core_mesh.DataplaneResource, inbounds []*mesh_proto.Dataplane_Networking_Inbound, policies []ConnectionPolicy) InboundConnectionPoliciesMap

SelectInboundConnectionMatchingPolicies picks all matching policies for each inbound interface of a given Dataplane.

type InboundConnectionPolicyMap

type InboundConnectionPolicyMap map[mesh_proto.InboundInterface]ConnectionPolicy

func SelectInboundConnectionPolicies

func SelectInboundConnectionPolicies(dataplane *core_mesh.DataplaneResource, inbounds []*mesh_proto.Dataplane_Networking_Inbound, policies []ConnectionPolicy) InboundConnectionPolicyMap

SelectInboundConnectionPolicies picks a single the most specific policy for each inbound interface of a given Dataplane. For each inbound we pick a policy that matches the most destination tags with inbound tags Sources part of matched policies are later used in Envoy config to apply it only for connection that matches sources

type InboundDataplanePolicyMap

type InboundDataplanePolicyMap map[mesh_proto.InboundInterface]DataplanePolicy

func SelectInboundDataplanePolicies

func SelectInboundDataplanePolicies(dataplane *mesh.DataplaneResource, policies []DataplanePolicy) InboundDataplanePolicyMap

SelectInboundDataplanePolicies given a Dataplane definition and a list of DataplanePolicy returns the "best matching" DataplanePolicy for each inbound separately. A DataplanePolicy for an inbound is considered a match if the inbound matches all the tags listed in selector of the DataplanePolicy. Every matching DataplanePolicy gets a rank (score) defined as a maximum number of tags in a matching selector. DataplanePolicy with an empty list of selectors is considered a match with a rank (score) of 0. DataplanePolicy with an empty selector (one that has no tags) is considered a match with a rank (score) of 0. In case if there are multiple DataplanePolicies with the same rank (score), the policy created last is chosen.

type OutboundConnectionPolicyMap

type OutboundConnectionPolicyMap map[core_xds.ServiceName]ConnectionPolicy

OutboundConnectionPolicyMap holds the most specific ConnectionPolicy for each outbound interface of a Dataplane.

func SelectConnectionPolicies

func SelectConnectionPolicies(dataplane *core_mesh.DataplaneResource, destinations ServiceIterator, policies []ConnectionPolicy) OutboundConnectionPolicyMap

SelectConnectionPolicies picks a single the most specific policy applicable to a connection between a given dataplane and given destination services.

func SelectOutboundConnectionPolicies

func SelectOutboundConnectionPolicies(dataplane *core_mesh.DataplaneResource, policies []ConnectionPolicy) OutboundConnectionPolicyMap

SelectOutboundConnectionPolicies picks a single the most specific policy for each outbound interface of a given Dataplane.

type ServiceIterator

type ServiceIterator interface {
	Next() (core_xds.ServiceName, bool)
}

func ToOutboundServicesOf

func ToOutboundServicesOf(dataplane *core_mesh.DataplaneResource) ServiceIterator

func ToServices

func ToServices(services []core_xds.ServiceName) ServiceIterator

func ToServicesOf

func ToServicesOf(destinations core_xds.DestinationMap) ServiceIterator

type ServiceIteratorFunc

type ServiceIteratorFunc func() (core_xds.ServiceName, bool)

func (ServiceIteratorFunc) Next

type TagMatcher added in v1.8.1

type TagMatcher func(selector mesh_proto.TagSelector) bool

A TagMatcher test whether a tag selector matches some predicate.

Jump to

Keyboard shortcuts

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