xds

package
v1.0.1-rc1 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

README

Xds adaptor

This module helps pixiu connect the go-control-panel, which implements by pixiu-admin(https://github.com/dubbogo/pixiu-admin), and read cluster and initial listener configurations. Pixiu talk to pixiu admin over XDS API. By this module, pixiu can be config by pixiu admin dynamically.

How to use

To config this module, some pixiu config should be change:


The node must add into the config to identify unique pixiu node.

node:
  id: "test-id"
  cluster: "pixiu"

Starting multi-node should give different node.id

"static_resources" should refer to the pixiu-admin.

static_resources:
  clusters:
    - name: "xds-server"
      type: "Static"
      endpoints:
        - socket_address:
            address: "127.0.0.1"
            port: 18000

config "lds_config" "cds_config" refer to the static_resources's cluster above.

dynamic_resources:
  lds_config: # config listener
    cluster_name: ["xds-server"]
    api_type: "GRPC"
    refresh_delay: "5s"
    request_timeout: "10s"
    grpc_services:
      - timeout: "5s"
  cds_config: # config cluster
    cluster_name: ["xds-server"]
    api_type: "GRPC"
    refresh_delay: "5s"
    request_timeout: "10s"
    grpc_services:
      - timeout: "5s"

Full demo config like below:


node:
  id: "test-id"
  cluster: "pixiu"

dynamic_resources:
  lds_config:
    cluster_name: ["xds-server"]
    api_type: "GRPC"
    refresh_delay: "5s"
    request_timeout: "10s"
    grpc_services:
      - timeout: "5s"
  cds_config:
    cluster_name: ["xds-server"]
    api_type: "GRPC"
    refresh_delay: "5s"
    request_timeout: "10s"
    grpc_services:
      - timeout: "5s"
static_resources:
  clusters:
    - name: "xds-server"
      type: "Static"
      endpoints:
        - socket_address:
            address: "127.0.0.1"
            port: 18000

  shutdown_config:
    timeout: "60s"
    step_timeout: "10s"
    reject_policy: "immediacy"

How does it work

This module start XDS API client when pixiu init. Once dynamic_resources config, it tries to connect go-control-panel and pull dubbo-go.pixiu/v1/discovery:listener(listener configurations) and dubbo-go.pixiu/v1/discovery:cluster(cluster configuration) via ExtensionConfigDiscovery.

This will fetch cluster configuration at initial time and consume ongoing changes. But for listener configuration, later changes has no affect until pixiu restart.

run unit test

GOARCH=amd64 go test -gcflags=-l -v -cover .

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdapterConfig

type AdapterConfig struct {
}

type CdsManager

type CdsManager struct {
	DiscoverApi
	// contains filtered or unexported fields
}

func (*CdsManager) Delta

func (c *CdsManager) Delta() error

func (*CdsManager) Fetch

func (c *CdsManager) Fetch() error

Fetch overwrite DiscoverApi.Fetch.

type Client

type Client interface {
	Stop()
}

Client xds client

func StartXdsClient

func StartXdsClient(listenerMg controls.ListenerManager, clusterMg controls.ClusterManager, drm controls.DynamicResourceManager) Client

StartXdsClient create XdsClient and run. only one xds client create at first(singleton)

type DiscoverApi

type DiscoverApi interface {
	Fetch(localVersion string) ([]*apiclient.ProtoAny, error)
	Delta() (chan *apiclient.DeltaResources, error)
}

type LdsManager

type LdsManager struct {
	DiscoverApi
	// contains filtered or unexported fields
}

func (*LdsManager) Delta

func (l *LdsManager) Delta() error

func (*LdsManager) Fetch

func (l *LdsManager) Fetch() error

Fetch overwrite DiscoverApi.Fetch.

type Xds

type Xds struct {
	// contains filtered or unexported fields
}

func (*Xds) Start

func (a *Xds) Start()

func (*Xds) Stop

func (a *Xds) Stop()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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