Documentation ¶
Index ¶
- Constants
- Variables
- func ClientComponentFrom(ctx context.Context) (string, bool)
- func FileExists(filename string) (bool, error)
- func FromApiserverCache(opts *metav1.GetOptions)
- func IfPoolScopedResourceFrom(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 NewTripleReadCloser(req *http.Request, rc io.ReadCloser, isRespBody bool) (io.ReadCloser, io.ReadCloser, io.ReadCloser)
- func NodeConditionsHaveChanged(originalConditions []v1.NodeCondition, conditions []v1.NodeCondition) bool
- func ParseBearerToken(token string) string
- func ParseTenantNs(certOrg string) string
- func ParseTenantNsFromOrgs(orgs []string) string
- func ReqCanCacheFrom(ctx context.Context) (bool, bool)
- 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 WithClientComponent(parent context.Context, component string) context.Context
- func WithIfPoolScopedResource(parent context.Context, ifPoolScoped bool) context.Context
- func WithListSelector(parent context.Context, selector string) context.Context
- func WithReqCanCache(parent context.Context, canCache bool) 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" // 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 // ProxyReqCanCache represents request can cache context key ProxyReqCanCache // ProxyListSelector represents label selector and filed selector string for list request ProxyListSelector // ProxyPoolScopedResource represents if this request is asking for pool-scoped resources ProxyPoolScopedResource // DefaultYurtCoordinatorEtcdSvcName represents default yurt coordinator etcd service DefaultYurtCoordinatorEtcdSvcName = "yurt-coordinator-etcd" // DefaultYurtCoordinatorAPIServerSvcName represents default yurt coordinator apiServer service DefaultYurtCoordinatorAPIServerSvcName = "yurt-coordinator-apiserver" // DefaultYurtCoordinatorEtcdSvcPort represents default yurt coordinator etcd port DefaultYurtCoordinatorEtcdSvcPort = "2379" // DefaultYurtCoordinatorAPIServerSvcPort represents default yurt coordinator apiServer port DefaultYurtCoordinatorAPIServerSvcPort = "443" YurtHubNamespace = "kube-system" CacheUserAgentsKey = "cache_agents" PoolScopeResourcesKey = "pool_scope_resources" YurtHubProxyPort = 10261 YurtHubPort = 10267 YurtHubProxySecurePort = 10268 )
Variables ¶
var ( DefaultCacheAgents = []string{"kubelet", "kube-proxy", "flanneld", "coredns", "raven-agent-ds", projectinfo.GetAgentName(), projectinfo.GetHubName(), coordinatorconstants.DefaultPoolScopedUserAgent} YurthubConfigMapName = fmt.Sprintf("%s-hub-cfg", strings.TrimRightFunc(projectinfo.GetProjectPrefix(), func(c rune) bool { return c == '-' })) )
Functions ¶
func ClientComponentFrom ¶
ClientComponentFrom returns the value of the client component key on the ctx
func FileExists ¶
FileExists checks if specified file exists.
func FromApiserverCache ¶ added in v1.5.0
func FromApiserverCache(opts *metav1.GetOptions)
func IfPoolScopedResourceFrom ¶ added in v1.2.0
IfPoolScopedResourceFrom returns the value of IfPoolScopedResource indicating whether this request is asking for pool-scoped resource.
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 NewTripleReadCloser ¶ added in v1.2.0
func NewTripleReadCloser(req *http.Request, rc io.ReadCloser, isRespBody bool) (io.ReadCloser, io.ReadCloser, io.ReadCloser)
func NodeConditionsHaveChanged ¶ added in v1.5.0
func NodeConditionsHaveChanged(originalConditions []v1.NodeCondition, conditions []v1.NodeCondition) bool
func ParseBearerToken ¶ added in v0.7.0
func ParseTenantNs ¶ added in v0.7.0
func ParseTenantNsFromOrgs ¶ added in v0.7.0
func ReqCanCacheFrom ¶
ReqCanCacheFrom returns the value of the request can cache key on the ctx
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 WithClientComponent ¶
WithClientComponent returns a copy of parent in which the client component value is set
func WithIfPoolScopedResource ¶ added in v1.2.0
WithIfPoolScopedResource returns a copy of parent in which IfPoolScopedResource is set, indicating whether this request is asking for pool-scoped resources.
func WithListSelector ¶
WithListSelector returns a copy of parent in which the list request selector string is set
func WithReqCanCache ¶
WithReqCanCache returns a copy of parent in which the request can cache value is set
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.