controller

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2018 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NotDDLOwnerError is the error message which was returned when the tidb node is not a ddl owner
	NotDDLOwnerError = "This node is not a ddl owner, can't be resigned."
)

Variables

View Source
var (

	// DefaultStorageClassName is the default storageClassName
	DefaultStorageClassName string
	// ClusterScoped controls whether operator should manage kubernetes cluster wide TiDB clusters
	ClusterScoped bool
)
View Source
var (
	TestStoreID       string = "000"
	TestMemberID      string = "111"
	TestClusterID     string = "222"
	TestName          string = "tidb-cluster"
	TestComponentName string = "tikv"
	TestPodName       string = "pod-1"
	TestManagedByName string = "tidb-operator"
	TestClusterName   string = "test"
)
View Source
var ExternalTrafficPolicy string

ExternalTrafficPolicy denotes if this Service desires to route external traffic to node-local or cluster-wide endpoints.

Functions

func AnnProm

func AnnProm(port int32) map[string]string

AnnProm adds annotations for prometheus scraping metrics

func DefaultPushGatewayRequest

func DefaultPushGatewayRequest() corev1.ResourceRequirements

DefaultPushGatewayRequest for the TiKV sidecar

func DeferClose

func DeferClose(c io.Closer, err *error)

DeferClose captures the error returned from closing (if an error occurs). This is designed to be used in a defer statement.

func GetOwnerRef

func GetOwnerRef(tc *v1alpha1.TidbCluster) metav1.OwnerReference

GetOwnerRef returns TidbCluster's OwnerReference

func GetPushgatewayImage

func GetPushgatewayImage(cluster *v1alpha1.TidbCluster) string

GetPushgatewayImage returns TidbCluster's pushgateway image

func GetServiceType

func GetServiceType(services []v1alpha1.Service, serviceName string) corev1.ServiceType

GetServiceType returns member's service type

func IsRequeueError added in v0.2.1

func IsRequeueError(err error) bool

IsRequeueError returns whether err is a RequeueError

func MonitorMemberName

func MonitorMemberName(clusterName string) string

MonitorMemberName returns monitor member name

func PDMemberName

func PDMemberName(clusterName string) string

PDMemberName returns pd member name

func PDPeerMemberName

func PDPeerMemberName(clusterName string) string

PDPeerMemberName returns pd peer service name

func PriTiDBMemberName

func PriTiDBMemberName(clusterName string) string

PriTiDBMemberName returns privileged tidb member name

func RequeueErrorf added in v0.2.1

func RequeueErrorf(format string, a ...interface{}) error

RequeueErrorf returns a RequeueError

func TiDBMemberName

func TiDBMemberName(clusterName string) string

TiDBMemberName returns tidb member name

func TiDBPeerMemberName added in v0.2.0

func TiDBPeerMemberName(clusterName string) string

TiDBPeerMemberName returns tidb peer service name

func TiKVCapacity

func TiKVCapacity(limits *v1alpha1.ResourceRequirement) string

TiKVCapacity returns string resource requirement, tikv uses GB, TB as unit suffix, but it actually means GiB, TiB

func TiKVMemberName

func TiKVMemberName(clusterName string) string

TiKVMemberName returns tikv member name

func TiKVPeerMemberName

func TiKVPeerMemberName(clusterName string) string

TiKVPeerMemberName returns tikv peer service name

Types

type Action

type Action struct {
	ID     uint64
	Name   string
	Labels map[string]string
}

type ActionType

type ActionType string
const (
	GetHealthActionType                ActionType = "GetHealth"
	GetConfigActionType                ActionType = "GetConfig"
	GetClusterActionType               ActionType = "GetCluster"
	GetMembersActionType               ActionType = "GetMembers"
	GetStoresActionType                ActionType = "GetStores"
	GetTombStoneStoresActionType       ActionType = "GetTombStoneStores"
	GetStoreActionType                 ActionType = "GetStore"
	DeleteStoreActionType              ActionType = "DeleteStore"
	DeleteMemberByIDActionType         ActionType = "DeleteMemberByID"
	DeleteMemberActionType             ActionType = "DeleteMember "
	SetStoreLabelsActionType           ActionType = "SetStoreLabels"
	BeginEvictLeaderActionType         ActionType = "BeginEvictLeader"
	EndEvictLeaderActionType           ActionType = "EndEvictLeader"
	GetEvictLeaderSchedulersActionType ActionType = "GetEvictLeaderSchedulers"
	GetPDLeaderActionType              ActionType = "GetPDLeader"
	TransferPDLeaderActionType         ActionType = "TransferPDLeader"
)

type FakePDClient

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

func NewFakePDClient

func NewFakePDClient() *FakePDClient

func (*FakePDClient) AddReaction

func (pc *FakePDClient) AddReaction(actionType ActionType, reaction Reaction)

func (*FakePDClient) BeginEvictLeader

func (pc *FakePDClient) BeginEvictLeader(storeID uint64) error

func (*FakePDClient) DeleteMember

func (pc *FakePDClient) DeleteMember(name string) error

func (*FakePDClient) DeleteMemberByID

func (pc *FakePDClient) DeleteMemberByID(id uint64) error

func (*FakePDClient) DeleteStore

func (pc *FakePDClient) DeleteStore(id uint64) error

func (*FakePDClient) EndEvictLeader

func (pc *FakePDClient) EndEvictLeader(storeID uint64) error

func (*FakePDClient) GetCluster

func (pc *FakePDClient) GetCluster() (*metapb.Cluster, error)

func (*FakePDClient) GetConfig

func (pc *FakePDClient) GetConfig() (*server.Config, error)

func (*FakePDClient) GetEvictLeaderSchedulers added in v0.3.0

func (pc *FakePDClient) GetEvictLeaderSchedulers() ([]string, error)

func (*FakePDClient) GetHealth

func (pc *FakePDClient) GetHealth() (*HealthInfo, error)

func (*FakePDClient) GetMembers

func (pc *FakePDClient) GetMembers() (*MembersInfo, error)

func (*FakePDClient) GetPDLeader added in v0.3.0

func (pc *FakePDClient) GetPDLeader() (*pdpb.Member, error)

func (*FakePDClient) GetStore

func (pc *FakePDClient) GetStore(id uint64) (*StoreInfo, error)

func (*FakePDClient) GetStores

func (pc *FakePDClient) GetStores() (*StoresInfo, error)

func (*FakePDClient) GetTombStoneStores

func (pc *FakePDClient) GetTombStoneStores() (*StoresInfo, error)

func (*FakePDClient) SetStoreLabels

func (pc *FakePDClient) SetStoreLabels(storeID uint64, labels map[string]string) (bool, error)

SetStoreLabels sets TiKV labels

func (*FakePDClient) TransferPDLeader added in v0.3.0

func (pc *FakePDClient) TransferPDLeader(memberName string) error

type FakePDControl

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

func NewFakePDControl

func NewFakePDControl() *FakePDControl

func (*FakePDControl) GetPDClient

func (pdc *FakePDControl) GetPDClient(tc *v1alpha1.TidbCluster) PDClient

GetPDClient provides a PDClient of real pd cluster,if the PDClient not existing, it will create new one.

func (*FakePDControl) SetPDClient

func (fpc *FakePDControl) SetPDClient(tc *v1alpha1.TidbCluster, pdclient PDClient)

type FakePVCControl

type FakePVCControl struct {
	PVCIndexer cache.Indexer
	// contains filtered or unexported fields
}

FakePVCControl is a fake PVCControlInterface

func NewFakePVCControl

func NewFakePVCControl(pvcInformer coreinformers.PersistentVolumeClaimInformer) *FakePVCControl

NewFakePVCControl returns a FakePVCControl

func (*FakePVCControl) DeletePVC

DeletePVC deletes the pvc

func (*FakePVCControl) SetDeletePVCError

func (fpc *FakePVCControl) SetDeletePVCError(err error, after int)

SetDeletePVCError sets the error attributes of deletePVCTracker

func (*FakePVCControl) SetUpdatePVCError

func (fpc *FakePVCControl) SetUpdatePVCError(err error, after int)

SetUpdatePVCError sets the error attributes of updatePVCTracker

func (*FakePVCControl) UpdateMetaInfo

UpdateMetaInfo updates the meta info of pvc

func (*FakePVCControl) UpdatePVC

Update updates the annotation, labels and spec of pvc

type FakePVControl

type FakePVControl struct {
	PVCLister corelisters.PersistentVolumeClaimLister
	PVIndexer cache.Indexer
	// contains filtered or unexported fields
}

FakePVControl is a fake PVControlInterface

func NewFakePVControl

NewFakePVControl returns a FakePVControl

func (*FakePVControl) PatchPVReclaimPolicy

func (fpc *FakePVControl) PatchPVReclaimPolicy(_ *v1alpha1.TidbCluster, pv *corev1.PersistentVolume, reclaimPolicy corev1.PersistentVolumeReclaimPolicy) error

PatchPVReclaimPolicy patchs the reclaim policy of PV

func (*FakePVControl) SetUpdatePVError

func (fpc *FakePVControl) SetUpdatePVError(err error, after int)

SetUpdatePVError sets the error attributes of updatePVTracker

func (*FakePVControl) UpdateMetaInfo

UpdateMetaInfo update the meta info of pv

type FakePodControl

type FakePodControl struct {
	PodIndexer cache.Indexer
	// contains filtered or unexported fields
}

FakePodControl is a fake PodControlInterface

func NewFakePodControl

func NewFakePodControl(podInformer coreinformers.PodInformer) *FakePodControl

NewFakePodControl returns a FakePodControl

func (*FakePodControl) DeletePod added in v0.2.0

func (fpc *FakePodControl) DeletePod(_ *v1alpha1.TidbCluster, pod *corev1.Pod) error

func (*FakePodControl) SetDeletePodError added in v0.2.0

func (fpc *FakePodControl) SetDeletePodError(err error, after int)

SetDeletePodError sets the error attributes of deletePodTracker

func (*FakePodControl) SetGetClusterError

func (fpc *FakePodControl) SetGetClusterError(err error, after int)

SetGetClusterError sets the error attributes of getClusterTracker

func (*FakePodControl) SetGetMemberError

func (fpc *FakePodControl) SetGetMemberError(err error, after int)

SetGetMemberError sets the error attributes of getMemberTracker

func (*FakePodControl) SetGetStoreError

func (fpc *FakePodControl) SetGetStoreError(err error, after int)

SetGetStoreError sets the error attributes of getStoreTracker

func (*FakePodControl) SetUpdatePodError

func (fpc *FakePodControl) SetUpdatePodError(err error, after int)

SetUpdatePodError sets the error attributes of updatePodTracker

func (*FakePodControl) UpdateMetaInfo

func (fpc *FakePodControl) UpdateMetaInfo(_ *v1alpha1.TidbCluster, pod *corev1.Pod) (*corev1.Pod, error)

UpdateMetaInfo update the meta info of Pod

func (*FakePodControl) UpdatePod added in v0.2.0

func (fpc *FakePodControl) UpdatePod(_ *v1alpha1.TidbCluster, pod *corev1.Pod) (*corev1.Pod, error)

type FakeServiceControl

type FakeServiceControl struct {
	SvcLister  corelisters.ServiceLister
	SvcIndexer cache.Indexer
	TcLister   v1listers.TidbClusterLister
	TcIndexer  cache.Indexer
	// contains filtered or unexported fields
}

FakeServiceControl is a fake ServiceControlInterface

func NewFakeServiceControl

func NewFakeServiceControl(svcInformer coreinformers.ServiceInformer, tcInformer tcinformers.TidbClusterInformer) *FakeServiceControl

NewFakeServiceControl returns a FakeServiceControl

func (*FakeServiceControl) CreateService

func (ssc *FakeServiceControl) CreateService(_ *v1alpha1.TidbCluster, svc *corev1.Service) error

CreateService adds the service to SvcIndexer

func (*FakeServiceControl) DeleteService

func (ssc *FakeServiceControl) DeleteService(_ *v1alpha1.TidbCluster, _ *corev1.Service) error

DeleteService deletes the service of SvcIndexer

func (*FakeServiceControl) SetCreateServiceError

func (ssc *FakeServiceControl) SetCreateServiceError(err error, after int)

SetCreateServiceError sets the error attributes of createServiceTracker

func (*FakeServiceControl) SetDeleteServiceError

func (ssc *FakeServiceControl) SetDeleteServiceError(err error, after int)

SetDeleteServiceError sets the error attributes of deleteServiceTracker

func (*FakeServiceControl) SetUpdateServiceError

func (ssc *FakeServiceControl) SetUpdateServiceError(err error, after int)

SetUpdateServiceError sets the error attributes of updateServiceTracker

func (*FakeServiceControl) UpdateService

func (ssc *FakeServiceControl) UpdateService(_ *v1alpha1.TidbCluster, svc *corev1.Service) (*corev1.Service, error)

UpdateService updates the service of SvcIndexer

type FakeStatefulSetControl

type FakeStatefulSetControl struct {
	SetLister  appslisters.StatefulSetLister
	SetIndexer cache.Indexer
	TcLister   v1listers.TidbClusterLister
	TcIndexer  cache.Indexer
	// contains filtered or unexported fields
}

FakeStatefulSetControl is a fake StatefulSetControlInterface

func NewFakeStatefulSetControl

func NewFakeStatefulSetControl(setInformer appsinformers.StatefulSetInformer, tcInformer tcinformers.TidbClusterInformer) *FakeStatefulSetControl

NewFakeStatefulSetControl returns a FakeStatefulSetControl

func (*FakeStatefulSetControl) CreateStatefulSet

func (ssc *FakeStatefulSetControl) CreateStatefulSet(_ *v1alpha1.TidbCluster, set *apps.StatefulSet) error

CreateStatefulSet adds the statefulset to SetIndexer

func (*FakeStatefulSetControl) DeleteStatefulSet

func (ssc *FakeStatefulSetControl) DeleteStatefulSet(_ *v1alpha1.TidbCluster, _ *apps.StatefulSet) error

DeleteStatefulSet deletes the statefulset of SetIndexer

func (*FakeStatefulSetControl) SetCreateStatefulSetError

func (ssc *FakeStatefulSetControl) SetCreateStatefulSetError(err error, after int)

SetCreateStatefulSetError sets the error attributes of createStatefulSetTracker

func (*FakeStatefulSetControl) SetDeleteStatefulSetError

func (ssc *FakeStatefulSetControl) SetDeleteStatefulSetError(err error, after int)

SetDeleteStatefulSetError sets the error attributes of deleteStatefulSetTracker

func (*FakeStatefulSetControl) SetStatusChange

func (ssc *FakeStatefulSetControl) SetStatusChange(fn func(*apps.StatefulSet))

func (*FakeStatefulSetControl) SetUpdateStatefulSetError

func (ssc *FakeStatefulSetControl) SetUpdateStatefulSetError(err error, after int)

SetUpdateStatefulSetError sets the error attributes of updateStatefulSetTracker

func (*FakeStatefulSetControl) UpdateStatefulSet

func (ssc *FakeStatefulSetControl) UpdateStatefulSet(_ *v1alpha1.TidbCluster, set *apps.StatefulSet) (*apps.StatefulSet, error)

UpdateStatefulSet updates the statefulset of SetIndexer

type FakeTiDBControl added in v0.2.0

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

FakeTiDBControl is a fake implementation of TiDBControlInterface.

func NewFakeTiDBControl added in v0.2.0

func NewFakeTiDBControl() *FakeTiDBControl

NewFakeTiDBControl returns a FakeTiDBControl instance

func (*FakeTiDBControl) GetHealth added in v0.2.0

func (ftd *FakeTiDBControl) GetHealth(_ *v1alpha1.TidbCluster) map[string]bool

func (*FakeTiDBControl) NotDDLOwner added in v0.3.0

func (ftd *FakeTiDBControl) NotDDLOwner(notDDLOwner bool)

NotDDLOwner sets whether the tidb is the ddl owner

func (*FakeTiDBControl) ResignDDLOwner added in v0.3.0

func (ftd *FakeTiDBControl) ResignDDLOwner(tc *v1alpha1.TidbCluster, ordinal int32) (bool, error)

func (*FakeTiDBControl) SetHealth added in v0.2.0

func (ftd *FakeTiDBControl) SetHealth(healthInfo map[string]bool)

SetHealth set health info for FakeTiDBControl

func (*FakeTiDBControl) SetResignDDLOwnerError added in v0.3.0

func (ftd *FakeTiDBControl) SetResignDDLOwnerError(err error)

SetResignDDLOwner sets error of resign ddl owner for FakeTiDBControl

type FakeTidbClusterControl added in v0.2.0

type FakeTidbClusterControl struct {
	TcLister  listers.TidbClusterLister
	TcIndexer cache.Indexer
	// contains filtered or unexported fields
}

FakeTidbClusterControl is a fake TidbClusterControlInterface

func NewFakeTidbClusterControl added in v0.2.0

func NewFakeTidbClusterControl(tcInformer tcinformers.TidbClusterInformer) *FakeTidbClusterControl

NewFakeTidbClusterControl returns a FakeTidbClusterControl

func (*FakeTidbClusterControl) SetUpdateTidbClusterError added in v0.2.0

func (ssc *FakeTidbClusterControl) SetUpdateTidbClusterError(err error, after int)

SetUpdateTidbClusterError sets the error attributes of updateTidbClusterTracker

func (*FakeTidbClusterControl) UpdateTidbCluster added in v0.2.0

UpdateTidbCluster updates the TidbCluster

type HealthInfo

type HealthInfo struct {
	Healths []MemberHealth
}

HealthInfo define PD's healthy info

type MemberHealth

type MemberHealth struct {
	Name       string   `json:"name"`
	MemberID   uint64   `json:"member_id"`
	ClientUrls []string `json:"client_urls"`
	Health     bool     `json:"health"`
}

MemberHealth define a pd member's healthy info

type MembersInfo

type MembersInfo struct {
	Header     *pdpb.ResponseHeader `json:"header,omitempty"`
	Members    []*pdpb.Member       `json:"members,omitempty"`
	Leader     *pdpb.Member         `json:"leader,omitempty"`
	EtcdLeader *pdpb.Member         `json:"etcd_leader,omitempty"`
}

MembersInfo is PD members info returned from PD RESTful interface type Members map[string][]*pdpb.Member

type MetaStore

type MetaStore struct {
	*metapb.Store
	StateName string `json:"state_name"`
}

MetaStore is TiKV store status defined in protobuf

type NotFoundReaction

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

func (*NotFoundReaction) Error

func (nfr *NotFoundReaction) Error() string

type PDClient

type PDClient interface {
	// GetHealth returns the PD's health info
	GetHealth() (*HealthInfo, error)
	// GetConfig returns PD's config
	GetConfig() (*server.Config, error)
	// GetCluster returns used when syncing pod labels.
	GetCluster() (*metapb.Cluster, error)
	// GetMembers returns all PD members from cluster
	GetMembers() (*MembersInfo, error)
	// GetStores lists all TiKV stores from cluster
	GetStores() (*StoresInfo, error)
	// GetTombStoneStores lists all tombstone stores from cluster
	GetTombStoneStores() (*StoresInfo, error)
	// GetStore gets a TiKV store for a specific store id from cluster
	GetStore(storeID uint64) (*StoreInfo, error)
	// storeLabelsEqualNodeLabels compares store labels with node labels
	// for historic reasons, PD stores TiKV labels as []*StoreLabel which is a key-value pair slice
	SetStoreLabels(storeID uint64, labels map[string]string) (bool, error)
	// DeleteStore deletes a TiKV store from cluster
	DeleteStore(storeID uint64) error
	// DeleteMember deletes a PD member from cluster
	DeleteMember(name string) error
	// DeleteMemberByID deletes a PD member from cluster
	DeleteMemberByID(memberID uint64) error
	// BeginEvictLeader initiates leader eviction for a storeID.
	// This is used when upgrading a pod.
	BeginEvictLeader(storeID uint64) error
	// EndEvictLeader is used at the end of pod upgrade.
	EndEvictLeader(storeID uint64) error
	// GetEvictLeaderSchedulers gets schedulers of evict leader
	GetEvictLeaderSchedulers() ([]string, error)
	// GetPDLeader returns pd leader
	GetPDLeader() (*pdpb.Member, error)
	// TransferPDLeader transfers pd leader to specified member
	TransferPDLeader(name string) error
}

PDClient provides pd server's api

func NewPDClient

func NewPDClient(url string, timeout time.Duration) PDClient

NewPDClient returns a new PDClient

type PDControlInterface

type PDControlInterface interface {
	// GetPDClient provides PDClient of the tidb cluster.
	GetPDClient(tc *v1alpha1.TidbCluster) PDClient
}

PDControlInterface is an interface that knows how to manage and get tidb cluster's PD client

func NewDefaultPDControl

func NewDefaultPDControl() PDControlInterface

NewDefaultPDControl returns a defaultPDControl instance

type PVCControlInterface

PVCControlInterface manages PVCs used in TidbCluster

func NewRealPVCControl

NewRealPVCControl creates a new PVCControlInterface

type PVControlInterface

type PVControlInterface interface {
	PatchPVReclaimPolicy(*v1alpha1.TidbCluster, *corev1.PersistentVolume, corev1.PersistentVolumeReclaimPolicy) error
	UpdateMetaInfo(*v1alpha1.TidbCluster, *corev1.PersistentVolume) (*corev1.PersistentVolume, error)
}

PVControlInterface manages PVs used in TidbCluster

func NewRealPVControl

NewRealPVControl creates a new PVControlInterface

type PodControlInterface

type PodControlInterface interface {
	// TODO change this to UpdatePod
	UpdateMetaInfo(*v1alpha1.TidbCluster, *corev1.Pod) (*corev1.Pod, error)
	DeletePod(*v1alpha1.TidbCluster, *corev1.Pod) error
	UpdatePod(*v1alpha1.TidbCluster, *corev1.Pod) (*corev1.Pod, error)
}

PodControlInterface manages Pods used in TidbCluster

func NewRealPodControl

func NewRealPodControl(
	kubeCli kubernetes.Interface,
	pdControl PDControlInterface,
	podLister corelisters.PodLister,
	recorder record.EventRecorder,
) PodControlInterface

NewRealPodControl creates a new PodControlInterface

type Reaction

type Reaction func(action *Action) (interface{}, error)

type RequeueError added in v0.2.1

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

RequeueError is used to requeue the item, this error type should't be considered as a real error

func (*RequeueError) Error added in v0.2.1

func (re *RequeueError) Error() string

type ServiceControlInterface

type ServiceControlInterface interface {
	CreateService(*v1alpha1.TidbCluster, *corev1.Service) error
	UpdateService(*v1alpha1.TidbCluster, *corev1.Service) (*corev1.Service, error)
	DeleteService(*v1alpha1.TidbCluster, *corev1.Service) error
}

ServiceControlInterface manages Services used in TidbCluster

func NewRealServiceControl

func NewRealServiceControl(kubeCli kubernetes.Interface, svcLister corelisters.ServiceLister, recorder record.EventRecorder) ServiceControlInterface

NewRealServiceControl creates a new ServiceControlInterface

type StatefulSetControlInterface

type StatefulSetControlInterface interface {
	// CreateStatefulSet creates a StatefulSet in a TidbCluster.
	CreateStatefulSet(*v1alpha1.TidbCluster, *apps.StatefulSet) error
	// UpdateStatefulSet updates a StatefulSet in a TidbCluster.
	UpdateStatefulSet(*v1alpha1.TidbCluster, *apps.StatefulSet) (*apps.StatefulSet, error)
	// DeleteStatefulSet deletes a StatefulSet in a TidbCluster.
	DeleteStatefulSet(*v1alpha1.TidbCluster, *apps.StatefulSet) error
}

StatefulSetControlInterface defines the interface that uses to create, update, and delete StatefulSets,

func NewRealStatefuSetControl

func NewRealStatefuSetControl(kubeCli kubernetes.Interface, setLister appslisters.StatefulSetLister, recorder record.EventRecorder) StatefulSetControlInterface

NewRealStatefuSetControl returns a StatefulSetControlInterface

type StoreInfo

type StoreInfo struct {
	Store  *MetaStore   `json:"store"`
	Status *StoreStatus `json:"status"`
}

StoreInfo is a single store info returned from PD RESTful interface

type StoreStatus

type StoreStatus struct {
	Capacity           typeutil.ByteSize `json:"capacity"`
	Available          typeutil.ByteSize `json:"available"`
	LeaderCount        int               `json:"leader_count"`
	RegionCount        int               `json:"region_count"`
	SendingSnapCount   uint32            `json:"sending_snap_count"`
	ReceivingSnapCount uint32            `json:"receiving_snap_count"`
	ApplyingSnapCount  uint32            `json:"applying_snap_count"`
	IsBusy             bool              `json:"is_busy"`

	StartTS         time.Time         `json:"start_ts"`
	LastHeartbeatTS time.Time         `json:"last_heartbeat_ts"`
	Uptime          typeutil.Duration `json:"uptime"`
}

StoreStatus is TiKV store status returned from PD RESTful interface

type StoresInfo

type StoresInfo struct {
	Count  int          `json:"count"`
	Stores []*StoreInfo `json:"stores"`
}

StoresInfo is stores info returned from PD RESTful interface

type TiDBControlInterface added in v0.2.0

type TiDBControlInterface interface {
	// GetHealth returns tidb's health info
	GetHealth(tc *v1alpha1.TidbCluster) map[string]bool
	// ResignDDLOwner resigns the ddl owner of tidb, if the tidb node is not a ddl owner returns (true,nil),else returns (false,err)
	ResignDDLOwner(tc *v1alpha1.TidbCluster, ordinal int32) (bool, error)
}

TiDBControlInterface is the interface that knows how to manage tidb peers

func NewDefaultTiDBControl added in v0.2.0

func NewDefaultTiDBControl() TiDBControlInterface

NewDefaultTiDBControl returns a defaultTiDBControl instance

type TidbClusterControlInterface added in v0.2.0

type TidbClusterControlInterface interface {
	UpdateTidbCluster(*v1alpha1.TidbCluster, *v1alpha1.TidbClusterStatus, *v1alpha1.TidbClusterStatus) (*v1alpha1.TidbCluster, error)
}

TidbClusterControlInterface manages TidbClusters

func NewRealTidbClusterControl added in v0.2.0

func NewRealTidbClusterControl(cli versioned.Interface,
	tcLister listers.TidbClusterLister,
	recorder record.EventRecorder) TidbClusterControlInterface

NewRealTidbClusterControl creates a new TidbClusterControlInterface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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