Documentation ¶
Index ¶
- Variables
- func EnsureGatewayHealthCheck(e *EndpointInfo, interval time.Duration, ctx context.Context)
- func MatchPolicies(requestAttributes authorizer.Attributes, ...) *proxyv1alpha1.DispatchPolicy
- func PolicyMatches(requestAttributes authorizer.Attributes, policy *proxyv1alpha1.DispatchPolicy) bool
- func RuleMatches(requestAttributes authorizer.Attributes, ...) bool
- type ClientProvider
- type ClusterInfo
- func (c *ClusterInfo) AllEndpoints() []string
- func (c *ClusterInfo) Context() context.Context
- func (c *ClusterInfo) FeatureEnabled(key featuregate.Feature) bool
- func (c *ClusterInfo) GetFlowSchema(name string) flowcontrol.FlowControl
- func (c *ClusterInfo) LoadTLSConfig() (*tls.Config, bool)
- func (c *ClusterInfo) LoadVerifyOptions() (x509.VerifyOptions, bool)
- func (c *ClusterInfo) MatchAttributes(requestAttributes authorizer.Attributes) (EndpointPicker, error)
- func (c *ClusterInfo) PickOne() (*EndpointInfo, error)
- func (c *ClusterInfo) Stop()
- func (c *ClusterInfo) Sync(cluster *proxyv1alpha1.UpstreamCluster) error
- type EndpointHealthCheck
- type EndpointInfo
- func (e *EndpointInfo) Clientset() kubernetes.Interface
- func (e *EndpointInfo) Context() context.Context
- func (e *EndpointInfo) IsReady() bool
- func (e *EndpointInfo) IstDisabled() bool
- func (e *EndpointInfo) SetDisabled(disabled bool)
- func (e *EndpointInfo) TriggerHealthCheck()
- func (e *EndpointInfo) UnreadyReason() string
- func (e *EndpointInfo) UpdateStatus(healthy bool, reason, message string)
- type EndpointInfoMap
- func (m *EndpointInfoMap) Load(name string) (*EndpointInfo, bool)
- func (m *EndpointInfoMap) LoadAndDelete(name string) (*EndpointInfo, bool)
- func (m *EndpointInfoMap) LoadOrStore(name string, ep *EndpointInfo) (*EndpointInfo, bool)
- func (m *EndpointInfoMap) Names() []string
- func (m *EndpointInfoMap) Range(rangeFn func(name string, info *EndpointInfo) bool)
- func (m *EndpointInfoMap) Store(name string, ep *EndpointInfo)
- type EndpointPicker
- type Manager
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoReadyEndpoints = errors.New("no ready endpoints") ErrNoRouterRuleMatches = errors.New("no router rule matches this request") )
View Source
var (
ErrClusterNotFound = errors.New("cluster not found")
)
Functions ¶
func EnsureGatewayHealthCheck ¶
func EnsureGatewayHealthCheck(e *EndpointInfo, interval time.Duration, ctx context.Context)
func MatchPolicies ¶
func MatchPolicies(requestAttributes authorizer.Attributes, policies []proxyv1alpha1.DispatchPolicy) *proxyv1alpha1.DispatchPolicy
func PolicyMatches ¶
func PolicyMatches(requestAttributes authorizer.Attributes, policy *proxyv1alpha1.DispatchPolicy) bool
func RuleMatches ¶
func RuleMatches(requestAttributes authorizer.Attributes, rule *proxyv1alpha1.DispatchPolicyRule) bool
Types ¶
type ClientProvider ¶
type ClientProvider interface {
ClientFor(name string) (*ClusterInfo, kubernetes.Interface, error)
}
type ClusterInfo ¶
type ClusterInfo struct { // server Cluster Cluster string // Endpoints hold all endpoint info, Endpoints *EndpointInfoMap // contains filtered or unexported fields }
ClusterInfo is a wrapper to a UpstreamCluster with additional information
func CreateClusterInfo ¶
func CreateClusterInfo(cluster *proxyv1alpha1.UpstreamCluster, healthCheck EndpointHealthCheck, rateLimiter string, clientSets clientsets.ClientSets, ) (*ClusterInfo, error)
CreateClusterInfo try every endpoint to find a ready endpoint, and then init rest config
func NewEmptyClusterInfo ¶
func NewEmptyClusterInfo(clusterName string, config *rest.Config, healthCheck EndpointHealthCheck, rateLimiter string, clientSets clientsets.ClientSets) *ClusterInfo
NewEmptyClusterInfo creates a empty ClusterInfo without UpstreamCluster information such as endpoints
func (*ClusterInfo) AllEndpoints ¶
func (c *ClusterInfo) AllEndpoints() []string
func (*ClusterInfo) Context ¶
func (c *ClusterInfo) Context() context.Context
func (*ClusterInfo) FeatureEnabled ¶
func (c *ClusterInfo) FeatureEnabled(key featuregate.Feature) bool
func (*ClusterInfo) GetFlowSchema ¶
func (c *ClusterInfo) GetFlowSchema(name string) flowcontrol.FlowControl
func (*ClusterInfo) LoadTLSConfig ¶
func (c *ClusterInfo) LoadTLSConfig() (*tls.Config, bool)
func (*ClusterInfo) LoadVerifyOptions ¶
func (c *ClusterInfo) LoadVerifyOptions() (x509.VerifyOptions, bool)
func (*ClusterInfo) MatchAttributes ¶
func (c *ClusterInfo) MatchAttributes(requestAttributes authorizer.Attributes) (EndpointPicker, error)
MatchAttributes matches a requestAttributes from reqeust and return a flowcontrol and endpointPicker
func (*ClusterInfo) PickOne ¶
func (c *ClusterInfo) PickOne() (*EndpointInfo, error)
func (*ClusterInfo) Stop ¶
func (c *ClusterInfo) Stop()
func (*ClusterInfo) Sync ¶
func (c *ClusterInfo) Sync(cluster *proxyv1alpha1.UpstreamCluster) error
Sync will only be triggered by upstream event handler, it is single thread. so there is no need to add a lock TODO: how to deal with clientConfig changes
type EndpointHealthCheck ¶
type EndpointHealthCheck func(*EndpointInfo) (done bool)
type EndpointInfo ¶
type EndpointInfo struct { Cluster string Endpoint string // http2 proxy round tripper ProxyTransport http.RoundTripper // http1 proxy round tripper for websocket PorxyUpgradeTransport proxy.UpgradeRequestRoundTripper sync.Mutex // contains filtered or unexported fields }
func (*EndpointInfo) Clientset ¶
func (e *EndpointInfo) Clientset() kubernetes.Interface
func (*EndpointInfo) Context ¶
func (e *EndpointInfo) Context() context.Context
func (*EndpointInfo) IsReady ¶
func (e *EndpointInfo) IsReady() bool
func (*EndpointInfo) IstDisabled ¶
func (e *EndpointInfo) IstDisabled() bool
func (*EndpointInfo) SetDisabled ¶
func (e *EndpointInfo) SetDisabled(disabled bool)
func (*EndpointInfo) TriggerHealthCheck ¶
func (e *EndpointInfo) TriggerHealthCheck()
func (*EndpointInfo) UnreadyReason ¶
func (e *EndpointInfo) UnreadyReason() string
func (*EndpointInfo) UpdateStatus ¶
func (e *EndpointInfo) UpdateStatus(healthy bool, reason, message string)
type EndpointInfoMap ¶
type EndpointInfoMap struct {
// contains filtered or unexported fields
}
func (*EndpointInfoMap) Load ¶
func (m *EndpointInfoMap) Load(name string) (*EndpointInfo, bool)
func (*EndpointInfoMap) LoadAndDelete ¶
func (m *EndpointInfoMap) LoadAndDelete(name string) (*EndpointInfo, bool)
func (*EndpointInfoMap) LoadOrStore ¶
func (m *EndpointInfoMap) LoadOrStore(name string, ep *EndpointInfo) (*EndpointInfo, bool)
func (*EndpointInfoMap) Names ¶
func (m *EndpointInfoMap) Names() []string
func (*EndpointInfoMap) Range ¶
func (m *EndpointInfoMap) Range(rangeFn func(name string, info *EndpointInfo) bool)
func (*EndpointInfoMap) Store ¶
func (m *EndpointInfoMap) Store(name string, ep *EndpointInfo)
type EndpointPicker ¶
type EndpointPicker interface { FlowControl() flowcontrol.FlowControl FlowControlName() string Pop() (*EndpointInfo, error) EnableLog() bool }
EndpointPicker knows
type Manager ¶
type Manager interface { Add(*ClusterInfo) Get(name string) (*ClusterInfo, bool) Delete(name string) DeleteAll() ClientProvider }
func NewManager ¶
func NewManager() Manager
Source Files ¶
Click to show internal directories.
Click to hide internal directories.