treat binary buildconfig instantiate requests as long running
@@ -7,6 +7,7 @@ import (
"net"
"net/http"
"net/url"
+ "regexp"
"strconv"
"strings"
"time"
@@ -30,6 +31,7 @@ import (
"k8s.io/kubernetes/pkg/cloudprovider"
"k8s.io/kubernetes/pkg/genericapiserver"
"k8s.io/kubernetes/pkg/genericapiserver/authorizer"
+ kgenericfilters "k8s.io/kubernetes/pkg/genericapiserver/filters"
openapicommon "k8s.io/kubernetes/pkg/genericapiserver/openapi/common"
"k8s.io/kubernetes/pkg/master"
"k8s.io/kubernetes/pkg/registry/cachesize"
@@ -55,6 +57,10 @@ import (
"github.com/openshift/origin/pkg/version"
)
+// request paths that match this regular expression will be treated as long running
+// and not subjected to the default server timeout.
+const originLongRunningEndpointsRE = "(/|^)buildconfigs/.*/instantiatebinary$"
+
var LegacyAPIGroupPrefixes = sets.NewString(genericapiserver.DefaultLegacyAPIPrefix, api.Prefix, api.LegacyPrefix)
// MasterConfig defines the required values to start a Kubernetes master
@@ -301,6 +307,13 @@ func BuildKubernetesMasterConfig(options configapi.MasterConfig, requestContextM
}
genericConfig.ExternalAddress = url.Host
+ originLongRunningRequestRE := regexp.MustCompile(originLongRunningEndpointsRE)
+ originLongRunningFunc := kgenericfilters.BasicLongRunningRequestCheck(originLongRunningRequestRE, nil)
+ kubeLongRunningFunc := genericConfig.LongRunningFunc
+ genericConfig.LongRunningFunc = func(r *http.Request) bool {
+ return originLongRunningFunc(r) || kubeLongRunningFunc(r)
+ }
+
serviceIPRange, apiServerServiceIP, err := genericapiserver.DefaultServiceIPRange(server.GenericServerRunOptions.ServiceClusterIPRange)
if err != nil {
glog.Fatalf("Error determining service IP ranges: %v", err)
