Documentation ¶
Index ¶
- func Err(err error, w http.ResponseWriter, req *http.Request)
- func IsEventCreateRequest(req *http.Request) bool
- func IsKubeletLeaseReq(req *http.Request) bool
- func IsListRequestWithNameFieldSelector(req *http.Request) bool
- func IsPoolScopedResouceListWatchRequest(req *http.Request) bool
- func IsSubjectAccessReviewCreateGetRequest(req *http.Request) bool
- func ReListWatchReq(rw http.ResponseWriter, req *http.Request)
- func WithCacheHeaderCheck(handler http.Handler) http.Handler
- func WithIfPoolScopedResource(handler http.Handler) http.Handler
- func WithListRequestSelector(handler http.Handler) http.Handler
- func WithMaxInFlightLimit(handler http.Handler, limit int) http.Handler
- func WithRequestClientComponent(handler http.Handler) http.Handler
- func WithRequestContentType(handler http.Handler) http.Handler
- func WithRequestTimeout(handler http.Handler) http.Handler
- func WithRequestTrace(handler http.Handler) http.Handler
- func WithRequestTraceFull(handler http.Handler) http.Handler
- func WithSaTokenSubstitute(handler http.Handler, tenantMgr tenant.Interface) http.Handler
- func WriteObject(statusCode int, obj runtime.Object, w http.ResponseWriter, req *http.Request) error
- type RemoteProxy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Err ¶ added in v1.2.0
func Err(err error, w http.ResponseWriter, req *http.Request)
Err write err to response writer
func IsEventCreateRequest ¶ added in v1.2.0
func IsKubeletLeaseReq ¶ added in v1.2.0
IsKubeletLeaseReq judge whether the request is a lease request from kubelet
func IsListRequestWithNameFieldSelector ¶ added in v1.2.0
IsListRequestWithNameFieldSelector will check if the request has FieldSelector "metadata.name". If found, return true, otherwise false.
func IsPoolScopedResouceListWatchRequest ¶ added in v1.2.0
func IsSubjectAccessReviewCreateGetRequest ¶ added in v1.2.0
func ReListWatchReq ¶ added in v1.2.1
func ReListWatchReq(rw http.ResponseWriter, req *http.Request)
func WithCacheHeaderCheck ¶
WithCacheHeaderCheck add cache agent for response cache in default mode, only kubelet, kube-proxy, flanneld, coredns User-Agent can be supported to cache response. and with Edge-Cache header is also supported.
func WithIfPoolScopedResource ¶ added in v1.2.0
func WithListRequestSelector ¶
WithListRequestSelector add label selector and field selector string in list request context.
func WithMaxInFlightLimit ¶
WithMaxInFlightLimit limits the number of in-flight requests. and when in flight requests exceeds the threshold, the following incoming requests will be rejected.
func WithRequestClientComponent ¶
WithRequestClientComponent add component field in request context. component is extracted from User-Agent Header, and only the content before the "/" when User-Agent include "/".
func WithRequestContentType ¶
WithRequestContentType add req-content-type in request context. if no Accept header is set, the request will be reject with a message.
func WithRequestTrace ¶
WithRequestTrace used to trace status code and latency for outward requests redirected from proxyserver to apiserver
func WithRequestTraceFull ¶ added in v1.0.0
WithRequestTraceFull used to trace the entire duration: coming to yurthub -> yurthub to apiserver -> leaving yurthub
func WithSaTokenSubstitute ¶ added in v0.7.0
func WriteObject ¶ added in v1.2.0
func WriteObject(statusCode int, obj runtime.Object, w http.ResponseWriter, req *http.Request) error
WriteObject write object to response writer
Types ¶
type RemoteProxy ¶ added in v1.2.0
type RemoteProxy struct {
// contains filtered or unexported fields
}
RemoteProxy is an reverse proxy for remote server
func NewRemoteProxy ¶ added in v1.2.0
func NewRemoteProxy(remoteServer *url.URL, modifyResponse func(*http.Response) error, errhandler func(http.ResponseWriter, *http.Request, error), transportMgr transport.Interface, stopCh <-chan struct{}) (*RemoteProxy, error)
NewRemoteProxy creates an *RemoteProxy object, and will be used by LoadBalancer
func (*RemoteProxy) Name ¶ added in v1.2.0
func (rp *RemoteProxy) Name() string
Name represents the address of remote server
func (*RemoteProxy) RemoteServer ¶ added in v1.2.0
func (rp *RemoteProxy) RemoteServer() *url.URL
func (*RemoteProxy) RoundTrip ¶ added in v1.2.0
RoundTrip is used to implement http.RoundTripper for RemoteProxy.
func (*RemoteProxy) ServeHTTP ¶ added in v1.2.0
func (rp *RemoteProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request)