Documentation ¶
Index ¶
- Constants
- func NewSnapshotCache(xdsCache cachev3.SnapshotCache, hook CacheHook) cachev3.SnapshotCache
- type CacheHook
- type Callbacks
- func (cb *Callbacks) OnDeltaStreamClosed(id int64)
- func (cb *Callbacks) OnDeltaStreamOpen(_ context.Context, id int64, typ string) error
- func (cb *Callbacks) OnFetchRequest(_ context.Context, req *discovery.DiscoveryRequest) error
- func (cb *Callbacks) OnFetchResponse(req *discovery.DiscoveryRequest, resp *discovery.DiscoveryResponse)
- func (cb *Callbacks) OnStreamClosed(id int64)
- func (cb *Callbacks) OnStreamDeltaRequest(id int64, req *discovery.DeltaDiscoveryRequest) error
- func (cb *Callbacks) OnStreamDeltaResponse(id int64, req *discovery.DeltaDiscoveryRequest, ...)
- func (cb *Callbacks) OnStreamOpen(_ context.Context, id int64, typ string) error
- func (cb *Callbacks) OnStreamRequest(id int64, req *discovery.DiscoveryRequest) error
- func (cb *Callbacks) OnStreamResponse(_ context.Context, id int64, req *discovery.DiscoveryRequest, ...)
- func (cb *Callbacks) Report()
- type CircuitBreakerConfigGetter
- type PerFilterConfigBuilder
- type PolarisNodeHash
- type RatelimitConfigGetter
- type RoutesBuilder
- type RunType
- type ServiceDomainBuilder
- type ServiceInfo
- type XDSClient
- type XDSNodeManager
- func (x *XDSNodeManager) AddNodeIfAbsent(streamId int64, node *core.Node)
- func (x *XDSNodeManager) DelNode(streamId int64)
- func (x *XDSNodeManager) GetNode(id string) *XDSClient
- func (x *XDSNodeManager) GetNodeByStreamID(streamId int64) *XDSClient
- func (x *XDSNodeManager) ListGatewayNodes() []*XDSClient
- type XDSServer
- func (x *XDSServer) GetPort() uint32
- func (x *XDSServer) GetProtocol() string
- func (x *XDSServer) Initialize(ctx context.Context, option map[string]interface{}, ...) error
- func (x *XDSServer) OnCreateDeltaWatch(request *cachev3.DeltaRequest, state stream.StreamState, ...)
- func (x *XDSServer) OnCreateWatch(request *cachev3.Request, streamState stream.StreamState, ...)
- func (x *XDSServer) OnFetch(ctx context.Context, request *cachev3.Request)
- func (x *XDSServer) Restart(option map[string]interface{}, apiConf map[string]apiserver.APIConfig, ...) error
- func (x *XDSServer) Run(errCh chan error)
- func (x *XDSServer) Stop()
Constants ¶
View Source
const ( // GatewayNamespaceName xds metadata key GatewayNamespaceName = "gateway_namespace" // GatewayNamespaceName xds metadata key GatewayServiceName = "gateway_service" )
View Source
const ( K8sDnsResolveSuffixSvc = ".svc" K8sDnsResolveSuffixSvcCluster = ".svc.cluster" K8sDnsResolveSuffixSvcClusterLocal = ".svc.cluster.local" )
View Source
const ( TLSModeTag = "polarismesh.cn/tls-mode" TLSModeNone = "none" TLSModeStrict = "strict" TLSModePermissive = "permissive" )
Variables ¶
This section is empty.
Functions ¶
func NewSnapshotCache ¶ added in v1.16.0
func NewSnapshotCache(xdsCache cachev3.SnapshotCache, hook CacheHook) cachev3.SnapshotCache
NewSnapshotCache create a XDS SnapshotCache to proxy cachev3.SnapshotCache
Types ¶
type CacheHook ¶ added in v1.16.0
type CacheHook interface { // OnCreateWatch OnCreateWatch(request *cachev3.Request, streamState stream.StreamState, value chan cachev3.Response) // OnCreateDeltaWatch OnCreateDeltaWatch(request *cachev3.DeltaRequest, state stream.StreamState, value chan cachev3.DeltaResponse) // OnFetch OnFetch(ctx context.Context, request *cachev3.Request) }
CacheHook
type Callbacks ¶
type Callbacks struct {
// contains filtered or unexported fields
}
func (*Callbacks) OnDeltaStreamClosed ¶
func (*Callbacks) OnDeltaStreamOpen ¶
func (*Callbacks) OnFetchRequest ¶
func (*Callbacks) OnFetchResponse ¶
func (cb *Callbacks) OnFetchResponse(req *discovery.DiscoveryRequest, resp *discovery.DiscoveryResponse)
func (*Callbacks) OnStreamClosed ¶
func (*Callbacks) OnStreamDeltaRequest ¶
func (cb *Callbacks) OnStreamDeltaRequest(id int64, req *discovery.DeltaDiscoveryRequest) error
func (*Callbacks) OnStreamDeltaResponse ¶
func (cb *Callbacks) OnStreamDeltaResponse(id int64, req *discovery.DeltaDiscoveryRequest, resp *discovery.DeltaDiscoveryResponse)
func (*Callbacks) OnStreamOpen ¶
func (*Callbacks) OnStreamRequest ¶
func (cb *Callbacks) OnStreamRequest(id int64, req *discovery.DiscoveryRequest) error
func (*Callbacks) OnStreamResponse ¶
func (cb *Callbacks) OnStreamResponse(_ context.Context, id int64, req *discovery.DiscoveryRequest, resp *discovery.DiscoveryResponse)
type CircuitBreakerConfigGetter ¶
type CircuitBreakerConfigGetter func(id string) *model.ServiceWithCircuitBreaker
type PerFilterConfigBuilder ¶ added in v1.16.0
type PerFilterConfigBuilder func(*ServiceInfo) map[string]*anypb.Any
type PolarisNodeHash ¶
type PolarisNodeHash struct{}
PolarisNodeHash 存放 hash 方法
func (PolarisNodeHash) ID ¶
func (PolarisNodeHash) ID(node *core.Node) string
ID id 的格式是 ${sidecar|gateway}~namespace/uuid~hostIp case 1: envoy 为 sidecar 模式时,则 NodeID 的格式为以下两种
eg 1. namespace/uuid~hostIp eg 2. sidecar~namespace/uuid-hostIp
case 2: envoy 为 gateway 模式时,则 NodeID 的格式为: gateway~namespace/uuid~hostIp
type RatelimitConfigGetter ¶
type RoutesBuilder ¶ added in v1.16.0
type RoutesBuilder func(*ServiceInfo) []*route.Route
type ServiceDomainBuilder ¶ added in v1.16.0
type ServiceDomainBuilder func(*ServiceInfo) []string
type ServiceInfo ¶
type ServiceInfo struct { ID string Name string Namespace string Instances []*apiservice.Instance SvcInsRevision string Routing *apitraffic.Routing SvcRoutingRevision string Ports string RateLimit *apitraffic.RateLimit SvcRateLimitRevision string }
ServiceInfo 北极星服务结构体
type XDSClient ¶ added in v1.16.0
type XDSClient struct { RunType RunType User string Namespace string IPAddr string Metadata map[string]string Version string Node *core.Node // contains filtered or unexported fields }
XDSClient 客户端代码结构体
type XDSNodeManager ¶ added in v1.16.0
type XDSNodeManager struct {
// contains filtered or unexported fields
}
func (*XDSNodeManager) AddNodeIfAbsent ¶ added in v1.16.0
func (x *XDSNodeManager) AddNodeIfAbsent(streamId int64, node *core.Node)
func (*XDSNodeManager) DelNode ¶ added in v1.16.0
func (x *XDSNodeManager) DelNode(streamId int64)
func (*XDSNodeManager) GetNode ¶ added in v1.16.0
func (x *XDSNodeManager) GetNode(id string) *XDSClient
func (*XDSNodeManager) GetNodeByStreamID ¶ added in v1.16.0
func (x *XDSNodeManager) GetNodeByStreamID(streamId int64) *XDSClient
func (*XDSNodeManager) ListGatewayNodes ¶ added in v1.16.0
func (x *XDSNodeManager) ListGatewayNodes() []*XDSClient
type XDSServer ¶
type XDSServer struct { CircuitBreakerConfigGetter CircuitBreakerConfigGetter RatelimitConfigGetter RatelimitConfigGetter // contains filtered or unexported fields }
XDSServer is the xDS server
func (*XDSServer) Initialize ¶
func (x *XDSServer) Initialize(ctx context.Context, option map[string]interface{}, apiConf map[string]apiserver.APIConfig) error
Initialize 初始化
func (*XDSServer) OnCreateDeltaWatch ¶ added in v1.16.0
func (x *XDSServer) OnCreateDeltaWatch(request *cachev3.DeltaRequest, state stream.StreamState, value chan cachev3.DeltaResponse)
OnCreateDeltaWatch before call cachev3.SnapshotCache OnCreateDeltaWatch
func (*XDSServer) OnCreateWatch ¶ added in v1.16.0
func (x *XDSServer) OnCreateWatch(request *cachev3.Request, streamState stream.StreamState, value chan cachev3.Response)
OnCreateWatch before call cachev3.SnapshotCache CreateWatch
Click to show internal directories.
Click to hide internal directories.