Skip to content

Commit

Permalink
Merge pull request #107 from yue9944882/fix-proxy-timeout
Browse files Browse the repository at this point in the history
Fixes proxy timeout
  • Loading branch information
Somefive authored Sep 15, 2022
2 parents 63b50f7 + bdd6692 commit 69b045c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions cmd/apiserver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,15 @@ import (
"github.com/oam-dev/cluster-gateway/pkg/metrics"
"github.com/oam-dev/cluster-gateway/pkg/options"
"github.com/oam-dev/cluster-gateway/pkg/util/singleton"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apiserver/pkg/endpoints/request"
"k8s.io/apiserver/pkg/server"
"k8s.io/klog/v2"
"net/http"
"sigs.k8s.io/apiserver-runtime/pkg/builder"
// +kubebuilder:scaffold:resource-imports
clusterv1alpha1 "github.com/oam-dev/cluster-gateway/pkg/apis/cluster/v1alpha1"
genericfilters "k8s.io/apiserver/pkg/server/filters"

_ "github.com/oam-dev/cluster-gateway/pkg/featuregates"
)
Expand All @@ -39,6 +44,15 @@ func main() {
ExposeLoopbackMasterClientConfig().
ExposeLoopbackAuthorizer().
WithoutEtcd().
WithConfigFns(func(config *server.RecommendedConfig) *server.RecommendedConfig {
config.LongRunningFunc = func(r *http.Request, requestInfo *request.RequestInfo) bool {
if requestInfo.Resource == "clustergateways" && requestInfo.Subresource == "proxy" {
return true
}
return genericfilters.BasicLongRunningRequestCheck(sets.NewString("watch"), sets.NewString())(r, requestInfo)
}
return config
}).
WithOptionsFns(func(options *builder.ServerOptions) *builder.ServerOptions {
if err := config.ValidateSecret(); err != nil {
klog.Fatal(err)
Expand Down

0 comments on commit 69b045c

Please sign in to comment.