Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Module = fx.Options( fx.Provide( ProvideMetrics, ProvideHandler, ), fx.Invoke(Register), )
Module is a set of default providers for flowcontrol components
Note that the handler needs to be Registered for flowcontrol to be available externally.
var ProvideDummyHandler = fx.Annotate(NewHandler, fx.As(new(HandlerWithValues)))
ProvideDummyHandler provides an empty Flow Control Handler.
Functions ¶
func Register ¶
func Register(server *grpc.Server, handler flowcontrolv1.FlowControlServiceServer, healthsrv *health.Server)
Register registers flowcontrol service on a grpc server.
Types ¶
type ConstructorIn ¶
type ConstructorIn struct { fx.In EntityCache *entitycache.EntityCache Metrics Metrics EngineAPI iface.Engine }
ConstructorIn holds parameters for ProvideHandler.
type Handler ¶
type Handler struct { flowcontrolv1.UnimplementedFlowControlServiceServer // contains filtered or unexported fields }
Handler implements the flowcontrol.v1 Service
It also accepts a pointer to an EntityCache for services lookup.
func NewHandler ¶
func NewHandler(entityCache *entitycache.EntityCache, metrics Metrics, engine iface.Engine) *Handler
NewHandler creates an empty flowcontrol Handler
It also accepts a pointer to an EntityCache for Infra Labels lookup.
func (*Handler) Check ¶
func (h *Handler) Check(ctx context.Context, req *flowcontrolv1.CheckRequest) (*flowcontrolv1.CheckResponse, error)
Check is the Check method of Flow Control service returns the allow/deny decisions of whether to accept the traffic after running the algorithms.
func (*Handler) CheckWithValues ¶
func (h *Handler) CheckWithValues( ctx context.Context, serviceIDs []string, controlPoint selectors.ControlPoint, labels map[string]string, ) *flowcontrolv1.CheckResponse
CheckWithValues makes decision using collected inferred fields from authz or Handler.
type HandlerWithValues ¶
type HandlerWithValues interface { CheckWithValues( context.Context, []string, selectors.ControlPoint, map[string]string, ) *flowcontrolv1.CheckResponse }
HandlerWithValues implements the flowcontrol.v1 service using collected inferred values.
func ProvideHandler ¶
func ProvideHandler(in ConstructorIn) (flowcontrolv1.FlowControlServiceServer, HandlerWithValues, error)
ProvideHandler provides a Flow Control Handler.
type Metrics ¶
type Metrics interface { // CheckResponse collects metrics about Aperture Check call with DecisionType and Reason. CheckResponse(flowcontrolv1.CheckResponse_DecisionType, flowcontrolv1.CheckResponse_RejectReason, flowcontrolv1.CheckResponse_Error) }
Metrics is used for collecting metrics about Aperture flowcontrol.
func ProvideMetrics ¶
func ProvideMetrics(promRegistry *prometheus.Registry) (Metrics, error)
ProvideMetrics provides flowcontrol metrics that hook to prometheus registry.
func ProvideNopMetrics ¶
func ProvideNopMetrics() Metrics
ProvideNopMetrics provides disabled flowcontrol metrics.
type NopMetrics ¶
type NopMetrics struct{}
NopMetrics is a no-op implementation of Metrics.
func (NopMetrics) CheckResponse ¶
func (NopMetrics) CheckResponse(flowcontrolv1.CheckResponse_DecisionType, flowcontrolv1.CheckResponse_RejectReason, flowcontrolv1.CheckResponse_Error)
CheckResponse is no-op method for NopMetrics.
type PrometheusMetrics ¶
type PrometheusMetrics struct {
// contains filtered or unexported fields
}
PrometheusMetrics stores collected metrics.
func NewPrometheusMetrics ¶
func NewPrometheusMetrics(registry *prometheus.Registry) (*PrometheusMetrics, error)
NewPrometheusMetrics creates a Prometheus metrics collector.
func (*PrometheusMetrics) CheckResponse ¶
func (pm *PrometheusMetrics) CheckResponse(decision flowcontrolv1.CheckResponse_DecisionType, rejectReason flowcontrolv1.CheckResponse_RejectReason, error flowcontrolv1.CheckResponse_Error)
CheckResponse collects metrics about Aperture Check call with DecisionType, RejectReason, Error.