apiserverk8s.io/apiserver/pkg/util/flowcontrol Index | Files | Directories

package flowcontrol

import "k8s.io/apiserver/pkg/util/flowcontrol"

Index

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 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 *fctypesv1a1.FlowSchema, pl *fctypesv1a1.PriorityLevelConfiguration),
		execFn func(),
	)

	// 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
}

Interface defines how the API Priority and Fairness filter interacts with the underlying system.

func New

func New(
	informerFactory kubeinformers.SharedInformerFactory,
	flowcontrolClient fcclientv1a1.FlowcontrolV1alpha1Interface,
	serverConcurrencyLimit int,
	requestWaitLimit time.Duration,
) Interface

New creates a new instance to implement API priority and fairness

func NewTestable

func NewTestable(
	informerFactory kubeinformers.SharedInformerFactory,
	flowcontrolClient fcclientv1a1.FlowcontrolV1alpha1Interface,
	serverConcurrencyLimit int,
	requestWaitLimit time.Duration,
	queueSetFactory fq.QueueSetFactory,
) 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 handlig 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.

Source Files

apf_controller.go apf_filter.go formatting.go rule.go

Directories

PathSynopsis
pkg/util/flowcontrol/counter
pkg/util/flowcontrol/fairqueuing
pkg/util/flowcontrol/fairqueuing/promise
pkg/util/flowcontrol/fairqueuing/promise/lockingpromise
pkg/util/flowcontrol/fairqueuing/queuesetPackage queueset implements a technique called "fair queuing for server requests".
pkg/util/flowcontrol/fairqueuing/testing
pkg/util/flowcontrol/fairqueuing/testing/clock
pkg/util/flowcontrol/format
pkg/util/flowcontrol/metrics
Version
v0.18.1
Published
Apr 8, 2020
Platform
js/wasm
Imports
36 packages
Last checked
51 seconds ago

Tools for package owners.