Documentation
¶
Overview ¶
Companion package for github.com/fluxninja/aperture/api/gen/proto/go/aperture/policy/language/v1 containing convertions of proto-generated struct into golang ones and other helpers.
Index ¶
- func CanonicalizeOtelHTTPFlavor(protocolName string) string
- func MMExprFromLabelMatcher(lm *labelmatcherv1.LabelMatcher) (mm.Expr, error)
- func MMExprFromProto(expr *labelmatcherv1.MatchExpression) (mm.Expr, error)
- type ControlPoint
- type ControlPointID
- type LabelSources
- type Labels
- type Selector
- type TrafficDirection
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanonicalizeOtelHTTPFlavor ¶ added in v0.2.0
CanonicalizeOtelHTTPFlavor converts envoy's protocol to Otel kind of HTTP protocol.
func MMExprFromLabelMatcher ¶
func MMExprFromLabelMatcher(lm *labelmatcherv1.LabelMatcher) (mm.Expr, error)
MMExprFromLabelMatcher translates proto definition of label matcher into a // single multimatcher expression
LabelMatcher can be nil or a validated LabelMatcher.
func MMExprFromProto ¶
func MMExprFromProto(expr *labelmatcherv1.MatchExpression) (mm.Expr, error)
MMExprFromProto converts proto definition of expression into multimatcher Expression
The expr is assumed to be validated and nonnil.
Types ¶
type ControlPoint ¶
type ControlPoint struct {
// FIXME(FLUX-2362) Stop hardcoding "envoy vs feature" (?)
// either
Feature string
// or
Traffic TrafficDirection
}
ControlPoint identifies control point within a service that the rule or policy should apply to
ControlPoint is either a library feature name or one of ingress / egress traffic control point.
func ControlPointFromProto ¶
func ControlPointFromProto(controlPoint *selectorv1.ControlPoint) ControlPoint
ControlPointFromProto creates a ControlPoint from "raw" proto-based ControlPoint
The controlPoint is assumed to be already validated and nonnil.
func (*ControlPoint) String ¶
func (p *ControlPoint) String() string
String returns a string representation of either a library feature name or a traffic direction.
type ControlPointID ¶
type ControlPointID struct {
ServiceID services.ServiceID
ControlPoint ControlPoint
}
ControlPointID uniquely identifies the control point within a cluster – so it's a ServiceID and ControlPoint combined
Control Point.
func ControlPointIDFromProto ¶
func ControlPointIDFromProto(selector *selectorv1.Selector) ControlPointID
ControlPointIDFromProto extracts a ControlPointID from proto-based selector (ignoring LabelMatcher)
Selector is assumed to be validated and non-nil.
func (ControlPointID) String ¶
func (p ControlPointID) String() string
String returns a string representation of control point and service.
type LabelSources ¶
type LabelSources struct {
// Baggage, classifier and explicit labels
Flow map[string]string
// Request labels
Request *ext_authz.AttributeContext_Request
}
LabelSources describes all the sources of labels.
type Labels ¶
Labels is a flattened map of labels expected to be in canonical form to be used in LabelMatchers in Selectors.
Canonical form implies appropriate prefixes for different types of labels, see https://docs.fluxninja.com/docs/development/concepts/flow-control/label/#sources
func NewLabels ¶
func NewLabels(ls LabelSources) Labels
NewLabels maps all available labels into a flat namespace, as documented in https://docs.fluxninja.com/docs/development/concepts/flow-control/label/#sources
func (Labels) CombinedWith ¶
func (l Labels) CombinedWith(newLabels LabelSources) Labels
CombinedWith combines existing labels with new labels from LabelSources.
The original labels map is unchanged. In case of duplicates, values from `newLabels` will be used.
func (Labels) ToPlainMap ¶
ToPlainMap extracts the underlying map of labels.
type Selector ¶
type Selector struct {
// Additionally, arbitrary label matcher can be used to match labels.
// For policies this matcher can _also_ match flow labels.
LabelMatcher mm.Expr
// ServiceID and control point are required
ControlPointID
}
Selector is a parsed/preprocessed version of policylangv1.Selector
refer to proto definition for docs.
type TrafficDirection ¶
type TrafficDirection int
TrafficDirection indicates enumerated traffic direction.
const ( // TrafficDirectionUndefined is a placeholder for undefined traffic direction. TrafficDirectionUndefined TrafficDirection = iota // Ingress is a traffic direction for inbound traffic. Ingress // Egress is a traffic direction for outbound traffic. Egress )
func (TrafficDirection) String ¶
func (d TrafficDirection) String() string
String returns a string representation of the traffic direction.