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
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
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 ¶
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
type LocalClusterProvider ¶
LocalClusterProvider ...
func (*LocalClusterProvider) SetUp ¶
func (l *LocalClusterProvider) SetUp(ctx context.Context, _ Specs) ([]Node, []ClientNode, error)
SetUp fills nodes and clientNodes
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
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 ¶
NewLocalClusterProvisioner reuses a local cluster