diff --git a/staging/src/k8s.io/apiserver/pkg/server/filters/longrunning.go b/staging/src/k8s.io/apiserver/pkg/server/filters/longrunning.go index 21c4562aa04..1b58f163865 100644 --- a/staging/src/k8s.io/apiserver/pkg/server/filters/longrunning.go +++ b/staging/src/k8s.io/apiserver/pkg/server/filters/longrunning.go @@ -18,12 +18,13 @@ package filters import ( "net/http" + "strings" "k8s.io/apimachinery/pkg/util/sets" 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 { return func(r *http.Request, requestInfo *apirequest.RequestInfo) bool { if longRunningVerbs.Has(requestInfo.Verb) { @@ -32,6 +33,9 @@ func BasicLongRunningRequestCheck(longRunningVerbs, longRunningSubresources sets if requestInfo.IsResourceRequest && longRunningSubresources.Has(requestInfo.Subresource) { return true } + if !requestInfo.IsResourceRequest && strings.HasPrefix(requestInfo.Path, "/debug/pprof/") { + return true + } return false } }