Documentation ¶
Index ¶
Constants ¶
const ConfigConsumerAsFieldManager = "api-priority-and-fairness-config-consumer-v1"
ConfigConsumerAsFieldManager is how the config consuminng controller appears in an ObjectMeta ManagedFieldsEntry.Manager
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Interface ¶
type Interface interface { // Handle takes care of queuing and dispatching a request // characterized by the given digest. The given `noteFn` will be // invoked with the results of request classification. If the // request is queued then `queueNoteFn` will be called twice, // first with `true` and then with `false`; otherwise // `queueNoteFn` will not be called at all. If Handle decides // that the request should be executed then `execute()` will be // invoked once to execute the request; otherwise `execute()` will // not be invoked. Handle(ctx context.Context, requestDigest RequestDigest, noteFn func(fs *flowcontrol.FlowSchema, pl *flowcontrol.PriorityLevelConfiguration), queueNoteFn fq.QueueNoteFn, execFn func(), ) // MaintainObservations is a helper for maintaining statistics. MaintainObservations(stopCh <-chan struct{}) // Run monitors config objects from the main apiservers and causes // any needed changes to local behavior. This method ceases // activity and returns after the given channel is closed. Run(stopCh <-chan struct{}) error // Install installs debugging endpoints to the web-server. Install(c *mux.PathRecorderMux) }
Interface defines how the API Priority and Fairness filter interacts with the underlying system.
func New ¶
func New( informerFactory kubeinformers.SharedInformerFactory, flowcontrolClient flowcontrolclient.FlowcontrolV1beta1Interface, serverConcurrencyLimit int, requestWaitLimit time.Duration, ) Interface
New creates a new instance to implement API priority and fairness
func NewTestable ¶
func NewTestable(config TestableConfig) Interface
NewTestable is extra flexible to facilitate testing
type RequestDigest ¶
type RequestDigest struct { RequestInfo *request.RequestInfo User user.Info }
RequestDigest holds necessary info from request for flow-control
func (RequestDigest) GoString ¶
func (rd RequestDigest) GoString() string
GoString produces a golang source expression of the value.
type StartFunction ¶
type StartFunction func(ctx context.Context, hashValue uint64) (execute bool, afterExecution func())
StartFunction begins the process of handling a request. If the request gets queued then this function uses the given hashValue as the source of entropy as it shuffle-shards the request into a queue. The descr1 and descr2 values play no role in the logic but appear in log messages. This method does not return until the queuing, if any, for this request is done. If `execute` is false then `afterExecution` is irrelevant and the request should be rejected. Otherwise the request should be executed and `afterExecution` must be called exactly once.
type TestableConfig ¶ added in v0.21.0
type TestableConfig struct { // InformerFactory to use in building the controller InformerFactory kubeinformers.SharedInformerFactory // FlowcontrolClient to use for manipulating config objects FlowcontrolClient flowcontrolclient.FlowcontrolV1beta1Interface // ServerConcurrencyLimit for the controller to enforce ServerConcurrencyLimit int // RequestWaitLimit configured on the server RequestWaitLimit time.Duration // ObsPairGenerator for metrics ObsPairGenerator metrics.TimedObserverPairGenerator // QueueSetFactory for the queuing implementation QueueSetFactory fq.QueueSetFactory }
TestableConfig carries the parameters to an implementation that is testable