Skip to content

Commit

Permalink
server/config: extend BasicLongRunningRequestCheck to add tunnel subr…
Browse files Browse the repository at this point in the history
…esource
  • Loading branch information
jmprusi committed Mar 15, 2023
1 parent c7108fa commit cbc665a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/server/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ import (
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apiserver/pkg/admission"
"k8s.io/apiserver/pkg/endpoints/filters"
"k8s.io/apiserver/pkg/endpoints/request"
"k8s.io/apiserver/pkg/informerfactoryhack"
"k8s.io/apiserver/pkg/quota/v1/generic"
genericapiserver "k8s.io/apiserver/pkg/server"
genericfilters "k8s.io/apiserver/pkg/server/filters"
serverstorage "k8s.io/apiserver/pkg/server/storage"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/cache"
Expand Down Expand Up @@ -360,6 +362,14 @@ func NewConfig(opts kcpserveroptions.CompletedOptions) (*Config, error) {
// Make sure to set our RequestInfoResolver that is capable of populating a RequestInfo even for /services/... URLs.
c.GenericConfig.RequestInfoResolver = requestinfo.NewKCPRequestInfoResolver()

if kcpfeatures.DefaultFeatureGate.Enabled(kcpfeatures.SyncerTunnel) {
kubeBasicLongRunningRequestCheck := c.GenericConfig.LongRunningFunc
tunnelBasicLongRunningRequestCheck := genericfilters.BasicLongRunningRequestCheck(sets.NewString(""), sets.NewString("tunnel"))
c.GenericConfig.LongRunningFunc = func(r *http.Request, requestInfo *request.RequestInfo) bool {
return kubeBasicLongRunningRequestCheck(r, requestInfo) || tunnelBasicLongRunningRequestCheck(r, requestInfo)
}
}

// preHandlerChainMux is called before the actual handler chain. Note that BuildHandlerChainFunc below
// is called multiple times, but only one of the handler chain will actually be used. Hence, we wrap it
// to give handlers below one mux.Handle func to call.
Expand Down

0 comments on commit cbc665a

Please sign in to comment.