util

package
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 12, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithCacheHeaderCheck

func WithCacheHeaderCheck(handler http.Handler) http.Handler

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 WithListRequestSelector

func WithListRequestSelector(handler http.Handler) http.Handler

WithListRequestSelector add label selector and field selector string in list request context.

func WithMaxInFlightLimit

func WithMaxInFlightLimit(handler http.Handler, limit int) http.Handler

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

func WithRequestClientComponent(handler http.Handler) http.Handler

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

func WithRequestContentType(handler http.Handler) http.Handler

WithRequestContentType add req-content-type in request context. if no Accept header is set, the request will be reject with a message.

func WithRequestTimeout

func WithRequestTimeout(handler http.Handler) http.Handler
  1. WithRequestTimeout add timeout context for watch request. timeout is TimeoutSeconds plus a margin(15 seconds). the timeout context is used to cancel the request for hub missed disconnect signal from kube-apiserver when watch request is ended.
  2. WithRequestTimeout reduce timeout context for get/list request. timeout is Timeout reduce a margin(2 seconds). When request remote server fail, can get data from cache before client timeout.

func WithRequestTrace

func WithRequestTrace(handler http.Handler) http.Handler

WithRequestTrace used to trace status code and latency for outward requests redirected from proxyserver to apiserver

func WithRequestTraceFull added in v1.0.0

func WithRequestTraceFull(handler http.Handler) http.Handler

WithRequestTraceFull used to trace the entire duration: coming to yurthub -> yurthub to apiserver -> leaving yurthub

func WithSaTokenSubstitute added in v0.7.0

func WithSaTokenSubstitute(handler http.Handler, tenantMgr tenant.Interface) http.Handler

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL