apiserver: k8s.io/apiserver/pkg/server/filters Index | Files

package filters

import "k8s.io/apiserver/pkg/server/filters"

Package filters contains all the http handler chain filters which are not api related.

Index

Package Files

content_type.go cors.go doc.go goaway.go longrunning.go maxinflight.go priority-and-fairness.go timeout.go waitgroup.go wrap.go

func BasicLongRunningRequestCheck Uses

func BasicLongRunningRequestCheck(longRunningVerbs, longRunningSubresources sets.String) apirequest.LongRunningRequestCheck

BasicLongRunningRequestCheck returns true if the given request has one of the specified verbs or one of the specified subresources, or is a profiler request.

func WithCORS Uses

func WithCORS(handler http.Handler, allowedOriginPatterns []string, allowedMethods []string, allowedHeaders []string, exposedHeaders []string, allowCredentials string) http.Handler

WithCORS is a simple CORS implementation that wraps an http Handler. Pass nil for allowedMethods and allowedHeaders to use the defaults. If allowedOriginPatterns is empty or nil, no CORS support is installed.

func WithContentType Uses

func WithContentType(handler http.Handler, contentType string) http.Handler

WithContentType sets both the Content-Type and the X-Content-Type-Options (nosniff) header

func WithMaxInFlightLimit Uses

func WithMaxInFlightLimit(
    handler http.Handler,
    nonMutatingLimit int,
    mutatingLimit int,
    longRunningRequestCheck apirequest.LongRunningRequestCheck,
) http.Handler

WithMaxInFlightLimit limits the number of in-flight requests to buffer size of the passed in channel.

func WithPanicRecovery Uses

func WithPanicRecovery(handler http.Handler) http.Handler

WithPanicRecovery wraps an http Handler to recover and log panics (except in the special case of http.ErrAbortHandler panics, which suppress logging).

func WithPriorityAndFairness Uses

func WithPriorityAndFairness(
    handler http.Handler,
    longRunningRequestCheck apirequest.LongRunningRequestCheck,
    fcIfc utilflowcontrol.Interface,
) http.Handler

WithPriorityAndFairness limits the number of in-flight requests in a fine-grained way.

func WithProbabilisticGoaway Uses

func WithProbabilisticGoaway(inner http.Handler, chance float64) http.Handler

WithProbabilisticGoaway returns an http.Handler that send GOAWAY probabilistically according to the given chance for HTTP2 requests. After client receive GOAWAY, the in-flight long-running requests will not be influenced, and the new requests will use a new TCP connection to re-balancing to another server behind the load balance.

func WithTimeout Uses

func WithTimeout(h http.Handler, timeoutFunc timeoutFunc) http.Handler

WithTimeout returns an http.Handler that runs h with a timeout determined by timeoutFunc. The new http.Handler calls h.ServeHTTP to handle each request, but if a call runs for longer than its time limit, the handler responds with a 504 Gateway Timeout error and the message provided. (If msg is empty, a suitable default message will be sent.) After the handler times out, writes by h to its http.ResponseWriter will return http.ErrHandlerTimeout. If timeoutFunc returns a nil timeout channel, no timeout will be enforced. recordFn is a function that will be invoked whenever a timeout happens.

func WithTimeoutForNonLongRunningRequests Uses

func WithTimeoutForNonLongRunningRequests(handler http.Handler, longRunning apirequest.LongRunningRequestCheck, timeout time.Duration) http.Handler

WithTimeoutForNonLongRunningRequests times out non-long-running requests after the time given by timeout.

func WithWaitGroup Uses

func WithWaitGroup(handler http.Handler, longRunning apirequest.LongRunningRequestCheck, wg *utilwaitgroup.SafeWaitGroup) http.Handler

WithWaitGroup adds all non long-running requests to wait group, which is used for graceful shutdown.

type GoawayDecider Uses

type GoawayDecider interface {
    Goaway(r *http.Request) bool
}

GoawayDecider decides if server should send a GOAWAY

type PriorityAndFairnessClassification Uses

type PriorityAndFairnessClassification struct {
    FlowSchemaName    string
    FlowSchemaUID     apitypes.UID
    PriorityLevelName string
    PriorityLevelUID  apitypes.UID
}

PriorityAndFairnessClassification identifies the results of classification for API Priority and Fairness

func GetClassification Uses

func GetClassification(ctx context.Context) *PriorityAndFairnessClassification

GetClassification returns the classification associated with the given context, if any, otherwise nil

Package filters imports 31 packages (graph) and is imported by 126 packages. Updated 2020-05-18. Refresh now. Tools for package owners.