Added API Priority and Fairness filter and config consumer

This commit is contained in:
Mike Spreitzer
2020-01-25 19:47:12 -05:00
parent 6eba154f6e
commit 73614ddd4e
32 changed files with 3117 additions and 316 deletions

View File

@@ -27,7 +27,14 @@ import (
// BuildInsecureHandlerChain sets up the server to listen to http. Should be removed.
func BuildInsecureHandlerChain(apiHandler http.Handler, c *server.Config) http.Handler {
handler := apiHandler
handler = genericfilters.WithMaxInFlightLimit(handler, c.MaxRequestsInFlight, c.MaxMutatingRequestsInFlight, c.LongRunningFunc)
// Temporarily disable APIPriorityAndFairness during development
// so that /debug/pprof works even while this feature is totally
// hosed
if c.FlowControl != nil && false {
handler = genericfilters.WithPriorityAndFairness(handler, c.LongRunningFunc, c.FlowControl)
} else {
handler = genericfilters.WithMaxInFlightLimit(handler, c.MaxRequestsInFlight, c.MaxMutatingRequestsInFlight, c.LongRunningFunc)
}
handler = genericapifilters.WithAudit(handler, c.AuditBackend, c.AuditPolicyChecker, c.LongRunningFunc)
handler = genericapifilters.WithAuthentication(handler, server.InsecureSuperuser{}, nil, nil)
handler = genericfilters.WithCORS(handler, c.CorsAllowedOriginList, nil, nil, nil, "true")