Documentation
¶
Index ¶
- Constants
- Variables
- func AttachConvertGVK(comp string, convertGVK *schema.GroupVersionKind) string
- func ClientComponentFrom(ctx context.Context) (string, bool)
- func ConvertGVKFrom(ctx context.Context) (*schema.GroupVersionKind, bool)
- func Err(err error, w http.ResponseWriter, req *http.Request)
- func FileExists(filename string) (bool, error)
- func ForwardRequestForPoolScopeMetadataFrom(ctx context.Context) (bool, bool)
- func FromApiserverCache(opts *metav1.GetOptions)
- func IsRequestForPoolScopeMetadataFrom(ctx context.Context) (bool, bool)
- func IsSupportedLBMode(lbMode string) bool
- func IsSupportedWorkingMode(workingMode WorkingMode) bool
- func ListSelectorFrom(ctx context.Context) (string, bool)
- func NewDualReadCloser(req *http.Request, rc io.ReadCloser, isRespBody bool) (io.ReadCloser, io.ReadCloser)
- func NewGZipReaderCloser(header http.Header, body io.ReadCloser, req *http.Request, caller string) (io.ReadCloser, bool)
- func NodeConditionsHaveChanged(originalConditions []v1.NodeCondition, conditions []v1.NodeCondition) bool
- func ObjectFilterFrom(ctx context.Context) (filter.ObjectFilter, bool)
- func ParseBearerToken(token string) string
- func ParseTenantNs(certOrg string) string
- func ParseTenantNsFromOrgs(orgs []string) string
- func ReqContentTypeFrom(ctx context.Context) (string, bool)
- func ReqInfoString(info *apirequest.RequestInfo) string
- func ReqString(req *http.Request) string
- func RespContentTypeFrom(ctx context.Context) (string, bool)
- func SetupDumpStackTrap(logDir string, stopCh <-chan struct{})
- func SplitKey(key string) (comp, resource, ns, name string)
- func TruncatedClientComponentFrom(ctx context.Context) (string, bool)
- func WithClientComponent(parent context.Context, component string) context.Context
- func WithConvertGVK(parent context.Context, gvk *schema.GroupVersionKind) context.Context
- func WithForwardRequestForPoolScopeMetadata(parent context.Context, forwardRequestForPoolScopeMetadata bool) context.Context
- func WithIsRequestForPoolScopeMetadata(parent context.Context, isRequestForPoolScopeMetadata bool) context.Context
- func WithListSelector(parent context.Context, selector string) context.Context
- func WithObjectFilter(parent context.Context, filters filter.ObjectFilter) context.Context
- func WithReqContentType(parent context.Context, contentType string) context.Context
- func WithRespContentType(parent context.Context, contentType string) context.Context
- func WithValue(parent context.Context, key interface{}, val interface{}) context.Context
- func WrapWithTrafficTrace(req *http.Request, resp *http.Response) *http.Response
- func WriteObject(statusCode int, obj runtime.Object, w http.ResponseWriter, req *http.Request) error
- type DialFunc
- type Dialer
- type ProxyKeyType
- type TrafficTraceReader
- type WorkingMode
Constants ¶
const ( // WorkingModeCloud represents yurthub is working in cloud mode, which means yurthub is deployed on the cloud side. WorkingModeCloud WorkingMode = "cloud" // WorkingModeEdge represents yurthub is working in edge mode, which means yurthub is deployed on the edge side. WorkingModeEdge WorkingMode = "edge" // WorkingModeLocal represents yurthub is working in local mode, which means yurthub is deployed on the local side. WorkingModeLocal WorkingMode = "local" // ProxyReqContentType represents request content type context key ProxyReqContentType ProxyKeyType = iota // ProxyRespContentType represents response content type context key ProxyRespContentType // ProxyClientComponent represents client component context key ProxyClientComponent // ProxyListSelector represents label selector and filed selector string for list request ProxyListSelector // ProxyConvertGVK represents the gvk of response when it is a partial object metadata request ProxyConvertGVK // ProxyPoolScopeMetadata represents a request is going to list/watch pool scope metadata or not. ProxyPoolScopeMetadata // ProxyForwardPoolScopeMetadata represents forward a request for pool scope metadata or not. ProxyForwardPoolScopeMetadata // ObjectFilter represents a request has filter. ObjectFilter YurtHubNamespace = "kube-system" CacheUserAgentsKey = "cache_agents" PoolScopeResourcesKey = "pool_scope_resources" MultiplexerProxyClientUserAgentPrefix = "multiplexer-proxy-" YurtHubProxyPort = 10261 YurtHubPort = 10267 YurtHubProxySecurePort = 10268 YurtHubMultiplexerPort = 10269 )
Variables ¶
var DefaultHubEndpointRestrictions = hubEndpointRestrictions{}
DefaultHubEndpointRestrictions is the default EndpointRestrictions which allows content-type negotiation to verify yurthub server support for specific options
var (
YurthubConfigMapName = fmt.Sprintf("%s-hub-cfg", strings.TrimRightFunc(projectinfo.GetProjectPrefix(), func(c rune) bool { return c == '-' }))
)
Functions ¶
func AttachConvertGVK ¶ added in v1.7.0
func AttachConvertGVK(comp string, convertGVK *schema.GroupVersionKind) string
AttachConvertGVK is used for adding partialobjectmetadata information into comp, because the response of partial object metadata request should be stored in a unique path for response is different with common requests.
func ClientComponentFrom ¶
ClientComponentFrom returns the value of the client component key on the ctx
func ConvertGVKFrom ¶ added in v1.7.0
func ConvertGVKFrom(ctx context.Context) (*schema.GroupVersionKind, bool)
ConvertGVKFrom returns the value of the convert gvk key on the ctx
func Err ¶
func Err(err error, w http.ResponseWriter, req *http.Request)
Err write err to response writer
func FileExists ¶
FileExists checks if specified file exists.
func ForwardRequestForPoolScopeMetadataFrom ¶ added in v1.7.0
ForwardRequestForPoolScopeMetadataFrom returns the value of the request for pool scope metadata on the ctx
func FromApiserverCache ¶ added in v1.5.0
func FromApiserverCache(opts *metav1.GetOptions)
func IsRequestForPoolScopeMetadataFrom ¶ added in v1.7.0
IsRequestForPoolScopeMetadataFrom returns the value of the request for pool scope metadata on the ctx
func IsSupportedLBMode ¶
IsSupportedLBMode check lb mode is supported or not
func IsSupportedWorkingMode ¶ added in v0.5.0
func IsSupportedWorkingMode(workingMode WorkingMode) bool
IsSupportedWorkingMode check working mode is supported or not
func ListSelectorFrom ¶
ListSelectorFrom returns the value of the list request selector string on the ctx
func NewDualReadCloser ¶
func NewDualReadCloser(req *http.Request, rc io.ReadCloser, isRespBody bool) (io.ReadCloser, io.ReadCloser)
NewDualReadCloser create an dualReadCloser object
func NewGZipReaderCloser ¶ added in v0.7.0
func NewGZipReaderCloser(header http.Header, body io.ReadCloser, req *http.Request, caller string) (io.ReadCloser, bool)
func NodeConditionsHaveChanged ¶ added in v1.5.0
func NodeConditionsHaveChanged(originalConditions []v1.NodeCondition, conditions []v1.NodeCondition) bool
func ObjectFilterFrom ¶ added in v1.7.0
func ObjectFilterFrom(ctx context.Context) (filter.ObjectFilter, bool)
func ParseBearerToken ¶ added in v0.7.0
func ParseTenantNs ¶ added in v0.7.0
func ParseTenantNsFromOrgs ¶ added in v0.7.0
func ReqContentTypeFrom ¶
ReqContentTypeFrom returns the value of the request content type key on the ctx
func ReqInfoString ¶
func ReqInfoString(info *apirequest.RequestInfo) string
ReqInfoString formats a string for request info
func RespContentTypeFrom ¶
RespContentTypeFrom returns the value of the response content type key on the ctx
func SetupDumpStackTrap ¶ added in v1.4.0
func SetupDumpStackTrap(logDir string, stopCh <-chan struct{})
func TruncatedClientComponentFrom ¶ added in v1.7.0
TruncatedClientComponentFrom returns the value of the client component key without slash on the ctx. only return the content before the first slash if user agent header includes slash.
func WithClientComponent ¶
WithClientComponent returns a copy of parent in which the client component value is set
func WithConvertGVK ¶ added in v1.7.0
WithConvertGVK returns a copy of parent in which the convert gvk value is set
func WithForwardRequestForPoolScopeMetadata ¶ added in v1.7.0
func WithForwardRequestForPoolScopeMetadata(parent context.Context, forwardRequestForPoolScopeMetadata bool) context.Context
WithForwardRequestForPoolScopeMetadata returns a copy of parent in which forward request for pool scope metadata value is set
func WithIsRequestForPoolScopeMetadata ¶ added in v1.7.0
func WithIsRequestForPoolScopeMetadata(parent context.Context, isRequestForPoolScopeMetadata bool) context.Context
WithIsRequestForPoolScopeMetadata returns a copy of parent in which request for pool scope metadata value is set
func WithListSelector ¶
WithListSelector returns a copy of parent in which the list request selector string is set
func WithObjectFilter ¶ added in v1.7.0
func WithReqContentType ¶
WithReqContentType returns a copy of parent in which the response content type value is set
func WithRespContentType ¶
WithRespContentType returns a copy of parent in which the request content type value is set
func WrapWithTrafficTrace ¶ added in v1.5.0
func WriteObject ¶
func WriteObject(statusCode int, obj runtime.Object, w http.ResponseWriter, req *http.Request) error
WriteObject write object to response writer
Types ¶
type Dialer ¶
type Dialer struct {
// contains filtered or unexported fields
}
Dialer opens connections through Dial and tracks them.
func NewDialer ¶
NewDialer creates a new Dialer instance.
If dial is not nil, it will be used to create new underlying connections. Otherwise, net.DialContext is used.
func (*Dialer) Close ¶
Close forcibly closes all tracked connections that specified by address.
Note: new connections may get created before Close returns.
func (*Dialer) CloseAll ¶
func (d *Dialer) CloseAll()
CloseAll forcibly closes all tracked connections.
Note: new connections may get created before CloseAll returns.
func (*Dialer) DialContext ¶
DialContext creates a new tracked connection.
type TrafficTraceReader ¶ added in v1.5.0
type TrafficTraceReader struct {
// contains filtered or unexported fields
}
func (*TrafficTraceReader) Close ¶ added in v1.5.0
func (tt *TrafficTraceReader) Close() error
type WorkingMode ¶ added in v0.5.0
type WorkingMode string
WorkingMode represents the working mode of yurthub.