cluster

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2020 License: Apache-2.0 Imports: 9 Imported by: 46

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Namespace    string
	ClusterName  string
	PDMemberFunc func(ns, name string) (string, []string, error)
}

Client provides useful methods about cluster

func (*Client) PDMember

func (c *Client) PDMember() (string, []string, error)

PDMember ...

type ClientNode

type ClientNode struct {
	Namespace   string // Cluster k8s' namespace
	ClusterName string // Cluster name, use to differentiate different TiDB clusters running on same namespace
	Component   Component
	IP          string
	Port        int32
}

ClientNode is TiDB's exposed endpoint, can be a nodeport, or downgrade cluster ip

func (ClientNode) Address

func (clientNode ClientNode) Address() string

Address returns the endpoint address of node

func (ClientNode) String

func (clientNode ClientNode) String() string

String ...

type Cluster

type Cluster interface {
	Apply() error
	Delete() error
	GetNodes() ([]Node, error)
	GetClientNodes() ([]ClientNode, error)
}

Cluster interface

type Component

type Component string

Component is the identifier of Cluster

const (
	// TiDB component identifier
	TiDB Component = "tidb"
	// TiKV component identifier
	TiKV Component = "tikv"
	// PD component identifier
	PD Component = "pd"
	// Pump Component identifier
	Pump Component = "pump"
	// Drainer Component identifier
	Drainer Component = "drainer"
	// CDC Component identifier
	CDC Component = "cdc"
	// DM Component identifier
	DM Component = "dm"
	// Monitor Component identifier
	Monitor Component = "monitor"
	// TiFlash Component identifier
	TiFlash Component = "tiflash"
	// MySQL Component identifier
	MySQL Component = "mysql"
	// Unknown component identifier
	Unknown Component = "unknown"
)

type K8sProvider

type K8sProvider struct {
	*tests.TestCli
}

K8sProvider implement Provider in k8s

func (*K8sProvider) SetUp

func (k *K8sProvider) SetUp(_ context.Context, spec Specs) ([]Node, []ClientNode, error)

SetUp sets up cluster, returns err or all nodes info

func (*K8sProvider) TearDown

func (k *K8sProvider) TearDown(_ context.Context, spec Specs) error

TearDown tears down the cluster

type LocalClusterProvider

type LocalClusterProvider struct {
	DBs []string
	PDs []string
	KVs []string
}

LocalClusterProvider ...

func (*LocalClusterProvider) SetUp

func (l *LocalClusterProvider) SetUp(ctx context.Context, _ Specs) ([]Node, []ClientNode, error)

SetUp fills nodes and clientNodes

func (*LocalClusterProvider) TearDown

func (l *LocalClusterProvider) TearDown(ctx context.Context, _ Specs) error

TearDown does nothing here

type Node

type Node struct {
	Namespace string    // Cluster k8s' namespace
	Component Component // Node component type
	PodName   string    // Pod's name
	IP        string
	Port      int32
	*Client   `json:"-"`
}

Node is the cluster endpoint in K8s, it's maybe podIP:port or CLUSTER-IP:port

func (Node) String

func (node Node) String() string

String ...

type Provider

type Provider interface {
	// SetUp sets up cluster, returns err or all nodes info
	SetUp(ctx context.Context, spec Specs) ([]Node, []ClientNode, error)
	// TearDown tears down the cluster
	TearDown(ctx context.Context, spec Specs) error
}

Provider provides a collection of APIs to deploy/destroy a cluster

func NewDefaultClusterProvider

func NewDefaultClusterProvider() Provider

NewDefaultClusterProvider ...

func NewK8sClusterProvider

func NewK8sClusterProvider() Provider

NewK8sClusterProvider create tidb cluster on k8s

func NewLocalClusterProvisioner

func NewLocalClusterProvisioner(dbs, pds, kvs []string) Provider

NewLocalClusterProvisioner reuses a local cluster

type Specs

type Specs struct {
	Cluster     Cluster
	NemesisGens []string
	Namespace   string
}

Specs is a cluster specification

Directories

Path Synopsis
manager

Jump to

Keyboard shortcuts

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