Commit aa4fd0b6 authored by Marcin Owsiany's avatar Marcin Owsiany

Do not time-out profiler requests.

parent da9a4d5d
...@@ -18,12 +18,13 @@ package filters ...@@ -18,12 +18,13 @@ package filters
import ( import (
"net/http" "net/http"
"strings"
"k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/sets"
apirequest "k8s.io/apiserver/pkg/endpoints/request" apirequest "k8s.io/apiserver/pkg/endpoints/request"
) )
// BasicLongRunningRequestCheck returns true if the given request has one of the specified verbs or one of the specified subresources // 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 BasicLongRunningRequestCheck(longRunningVerbs, longRunningSubresources sets.String) apirequest.LongRunningRequestCheck { func BasicLongRunningRequestCheck(longRunningVerbs, longRunningSubresources sets.String) apirequest.LongRunningRequestCheck {
return func(r *http.Request, requestInfo *apirequest.RequestInfo) bool { return func(r *http.Request, requestInfo *apirequest.RequestInfo) bool {
if longRunningVerbs.Has(requestInfo.Verb) { if longRunningVerbs.Has(requestInfo.Verb) {
...@@ -32,6 +33,9 @@ func BasicLongRunningRequestCheck(longRunningVerbs, longRunningSubresources sets ...@@ -32,6 +33,9 @@ func BasicLongRunningRequestCheck(longRunningVerbs, longRunningSubresources sets
if requestInfo.IsResourceRequest && longRunningSubresources.Has(requestInfo.Subresource) { if requestInfo.IsResourceRequest && longRunningSubresources.Has(requestInfo.Subresource) {
return true return true
} }
if !requestInfo.IsResourceRequest && strings.HasPrefix(requestInfo.Path, "/debug/pprof/") {
return true
}
return false return false
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment