mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 18:24:07 +00:00
Periodically flush the reverse proxy.
This commit is contained in:
parent
2d88675f22
commit
8c27609382
@ -24,6 +24,7 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
@ -36,6 +37,16 @@ const (
|
|||||||
DefaultMethodRejectRE = "POST,PUT,PATCH"
|
DefaultMethodRejectRE = "POST,PUT,PATCH"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
// The reverse proxy will periodically flush the io writer at this frequency.
|
||||||
|
// Only matters for long poll connections like the one used to watch. With an
|
||||||
|
// interval of 0 the reverse proxy will buffer content sent on any connection
|
||||||
|
// with transfer-encoding=chunked.
|
||||||
|
// TODO: Flush after each chunk so the client doesn't suffer a 100ms latency per
|
||||||
|
// watch event.
|
||||||
|
ReverseProxyFlushInterval = 100 * time.Millisecond
|
||||||
|
)
|
||||||
|
|
||||||
// FilterServer rejects requests which don't match one of the specified regular expressions
|
// FilterServer rejects requests which don't match one of the specified regular expressions
|
||||||
type FilterServer struct {
|
type FilterServer struct {
|
||||||
// Only paths that match this regexp will be accepted
|
// Only paths that match this regexp will be accepted
|
||||||
@ -171,7 +182,7 @@ func newProxy(target *url.URL) *httputil.ReverseProxy {
|
|||||||
req.URL.Host = target.Host
|
req.URL.Host = target.Host
|
||||||
req.URL.Path = singleJoiningSlash(target.Path, req.URL.Path)
|
req.URL.Path = singleJoiningSlash(target.Path, req.URL.Path)
|
||||||
}
|
}
|
||||||
return &httputil.ReverseProxy{Director: director}
|
return &httputil.ReverseProxy{Director: director, FlushInterval: ReverseProxyFlushInterval}
|
||||||
}
|
}
|
||||||
|
|
||||||
func newFileHandler(prefix, base string) http.Handler {
|
func newFileHandler(prefix, base string) http.Handler {
|
||||||
|
Loading…
Reference in New Issue
Block a user