xdsserverv3

package
v1.16.4 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2023 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 3 more Imports: 68 Imported by: 0

Documentation

Index

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 (cb *Callbacks) OnDeltaStreamClosed(id int64)

func (*Callbacks) OnDeltaStreamOpen

func (cb *Callbacks) OnDeltaStreamOpen(_ context.Context, id int64, typ string) error

func (*Callbacks) OnFetchRequest

func (cb *Callbacks) OnFetchRequest(_ context.Context, req *discovery.DiscoveryRequest) error

func (*Callbacks) OnFetchResponse

func (cb *Callbacks) OnFetchResponse(req *discovery.DiscoveryRequest, resp *discovery.DiscoveryResponse)

func (*Callbacks) OnStreamClosed

func (cb *Callbacks) OnStreamClosed(id int64)

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 (cb *Callbacks) OnStreamOpen(_ context.Context, id int64, typ string) error

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)

func (*Callbacks) Report

func (cb *Callbacks) Report()

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 RatelimitConfigGetter func(serviceID string) []*model.RateLimit

type RoutesBuilder added in v1.16.0

type RoutesBuilder func(*ServiceInfo) []*route.Route

type RunType added in v1.16.0

type RunType string
var (
	// RunTypeGateway xds node run type is gateway
	RunTypeGateway RunType = "gateway"
	// RunTypeSidecar xds node run type is sidecar
	RunTypeSidecar RunType = "sidecar"
)

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 客户端代码结构体

func (*XDSClient) IsGateway added in v1.16.0

func (n *XDSClient) IsGateway() bool

func (*XDSClient) RunOnce added in v1.16.0

func (n *XDSClient) RunOnce(key string, f func())

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) GetPort

func (x *XDSServer) GetPort() uint32

GetPort 服务注册到北极星中的端口

func (*XDSServer) GetProtocol

func (x *XDSServer) GetProtocol() string

GetProtocol 服务注册到北极星中的协议

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

func (*XDSServer) OnFetch added in v1.16.0

func (x *XDSServer) OnFetch(ctx context.Context, request *cachev3.Request)

OnFetch before call cachev3.SnapshotCache OnFetch

func (*XDSServer) Restart

func (x *XDSServer) Restart(option map[string]interface{}, apiConf map[string]apiserver.APIConfig,
	errCh chan error) error

Restart 重启服务

func (*XDSServer) Run

func (x *XDSServer) Run(errCh chan error)

Run 启动运行

func (*XDSServer) Stop

func (x *XDSServer) Stop()

Stop 停止服务

Jump to

Keyboard shortcuts

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