Documentation
¶
Index ¶
- Constants
- Variables
- func AnnProm(port int32) map[string]string
- func DefaultPushGatewayRequest() corev1.ResourceRequirements
- func DeferClose(c io.Closer, err *error)
- func GetOwnerRef(tc *v1alpha1.TidbCluster) metav1.OwnerReference
- func GetPushgatewayImage(cluster *v1alpha1.TidbCluster) string
- func GetServiceType(services []v1alpha1.Service, serviceName string) corev1.ServiceType
- func IsRequeueError(err error) bool
- func MonitorMemberName(clusterName string) string
- func PDMemberName(clusterName string) string
- func PDPeerMemberName(clusterName string) string
- func PriTiDBMemberName(clusterName string) string
- func RequeueErrorf(format string, a ...interface{}) error
- func TiDBMemberName(clusterName string) string
- func TiDBPeerMemberName(clusterName string) string
- func TiKVCapacity(limits *v1alpha1.ResourceRequirement) string
- func TiKVMemberName(clusterName string) string
- func TiKVPeerMemberName(clusterName string) string
- type Action
- type ActionType
- type FakePDClient
- func (pc *FakePDClient) AddReaction(actionType ActionType, reaction Reaction)
- func (pc *FakePDClient) BeginEvictLeader(storeID uint64) error
- func (pc *FakePDClient) DeleteMember(name string) error
- func (pc *FakePDClient) DeleteMemberByID(id uint64) error
- func (pc *FakePDClient) DeleteStore(id uint64) error
- func (pc *FakePDClient) EndEvictLeader(storeID uint64) error
- func (pc *FakePDClient) GetCluster() (*metapb.Cluster, error)
- func (pc *FakePDClient) GetConfig() (*server.Config, error)
- func (pc *FakePDClient) GetEvictLeaderSchedulers() ([]string, error)
- func (pc *FakePDClient) GetHealth() (*HealthInfo, error)
- func (pc *FakePDClient) GetMembers() (*MembersInfo, error)
- func (pc *FakePDClient) GetPDLeader() (*pdpb.Member, error)
- func (pc *FakePDClient) GetStore(id uint64) (*StoreInfo, error)
- func (pc *FakePDClient) GetStores() (*StoresInfo, error)
- func (pc *FakePDClient) GetTombStoneStores() (*StoresInfo, error)
- func (pc *FakePDClient) SetStoreLabels(storeID uint64, labels map[string]string) (bool, error)
- func (pc *FakePDClient) TransferPDLeader(memberName string) error
- type FakePDControl
- type FakePVCControl
- func (fpc *FakePVCControl) DeletePVC(_ *v1alpha1.TidbCluster, pvc *corev1.PersistentVolumeClaim) error
- func (fpc *FakePVCControl) SetDeletePVCError(err error, after int)
- func (fpc *FakePVCControl) SetUpdatePVCError(err error, after int)
- func (fpc *FakePVCControl) UpdateMetaInfo(_ *v1alpha1.TidbCluster, pvc *corev1.PersistentVolumeClaim, pod *corev1.Pod) (*corev1.PersistentVolumeClaim, error)
- func (fpc *FakePVCControl) UpdatePVC(_ *v1alpha1.TidbCluster, pvc *corev1.PersistentVolumeClaim) (*corev1.PersistentVolumeClaim, error)
- type FakePVControl
- func (fpc *FakePVControl) PatchPVReclaimPolicy(_ *v1alpha1.TidbCluster, pv *corev1.PersistentVolume, ...) error
- func (fpc *FakePVControl) SetUpdatePVError(err error, after int)
- func (fpc *FakePVControl) UpdateMetaInfo(tc *v1alpha1.TidbCluster, pv *corev1.PersistentVolume) (*corev1.PersistentVolume, error)
- type FakePodControl
- func (fpc *FakePodControl) DeletePod(_ *v1alpha1.TidbCluster, pod *corev1.Pod) error
- func (fpc *FakePodControl) SetDeletePodError(err error, after int)
- func (fpc *FakePodControl) SetGetClusterError(err error, after int)
- func (fpc *FakePodControl) SetGetMemberError(err error, after int)
- func (fpc *FakePodControl) SetGetStoreError(err error, after int)
- func (fpc *FakePodControl) SetUpdatePodError(err error, after int)
- func (fpc *FakePodControl) UpdateMetaInfo(_ *v1alpha1.TidbCluster, pod *corev1.Pod) (*corev1.Pod, error)
- func (fpc *FakePodControl) UpdatePod(_ *v1alpha1.TidbCluster, pod *corev1.Pod) (*corev1.Pod, error)
- type FakeServiceControl
- func (ssc *FakeServiceControl) CreateService(_ *v1alpha1.TidbCluster, svc *corev1.Service) error
- func (ssc *FakeServiceControl) DeleteService(_ *v1alpha1.TidbCluster, _ *corev1.Service) error
- func (ssc *FakeServiceControl) SetCreateServiceError(err error, after int)
- func (ssc *FakeServiceControl) SetDeleteServiceError(err error, after int)
- func (ssc *FakeServiceControl) SetUpdateServiceError(err error, after int)
- func (ssc *FakeServiceControl) UpdateService(_ *v1alpha1.TidbCluster, svc *corev1.Service) (*corev1.Service, error)
- type FakeStatefulSetControl
- func (ssc *FakeStatefulSetControl) CreateStatefulSet(_ *v1alpha1.TidbCluster, set *apps.StatefulSet) error
- func (ssc *FakeStatefulSetControl) DeleteStatefulSet(_ *v1alpha1.TidbCluster, _ *apps.StatefulSet) error
- func (ssc *FakeStatefulSetControl) SetCreateStatefulSetError(err error, after int)
- func (ssc *FakeStatefulSetControl) SetDeleteStatefulSetError(err error, after int)
- func (ssc *FakeStatefulSetControl) SetStatusChange(fn func(*apps.StatefulSet))
- func (ssc *FakeStatefulSetControl) SetUpdateStatefulSetError(err error, after int)
- func (ssc *FakeStatefulSetControl) UpdateStatefulSet(_ *v1alpha1.TidbCluster, set *apps.StatefulSet) (*apps.StatefulSet, error)
- type FakeTiDBControl
- func (ftd *FakeTiDBControl) GetHealth(_ *v1alpha1.TidbCluster) map[string]bool
- func (ftd *FakeTiDBControl) NotDDLOwner(notDDLOwner bool)
- func (ftd *FakeTiDBControl) ResignDDLOwner(tc *v1alpha1.TidbCluster, ordinal int32) (bool, error)
- func (ftd *FakeTiDBControl) SetHealth(healthInfo map[string]bool)
- func (ftd *FakeTiDBControl) SetResignDDLOwnerError(err error)
- type FakeTidbClusterControl
- type HealthInfo
- type MemberHealth
- type MembersInfo
- type MetaStore
- type NotFoundReaction
- type PDClient
- type PDControlInterface
- type PVCControlInterface
- type PVControlInterface
- type PodControlInterface
- type Reaction
- type RequeueError
- type ServiceControlInterface
- type StatefulSetControlInterface
- type StoreInfo
- type StoreStatus
- type StoresInfo
- type TiDBControlInterface
- type TidbClusterControlInterface
Constants ¶
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 ¶
var ( // DefaultStorageClassName is the default storageClassName DefaultStorageClassName string // ClusterScoped controls whether operator should manage kubernetes cluster wide TiDB clusters ClusterScoped bool )
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" )
var ExternalTrafficPolicy string
ExternalTrafficPolicy denotes if this Service desires to route external traffic to node-local or cluster-wide endpoints.
Functions ¶
func DefaultPushGatewayRequest ¶
func DefaultPushGatewayRequest() corev1.ResourceRequirements
DefaultPushGatewayRequest for the TiKV sidecar
func DeferClose ¶
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
IsRequeueError returns whether err is a RequeueError
func MonitorMemberName ¶
MonitorMemberName returns monitor member name
func PDMemberName ¶
PDMemberName returns pd member name
func PDPeerMemberName ¶
PDPeerMemberName returns pd peer service name
func PriTiDBMemberName ¶
PriTiDBMemberName returns privileged tidb member name
func RequeueErrorf ¶ added in v0.2.1
RequeueErrorf returns a RequeueError
func TiDBMemberName ¶
TiDBMemberName returns tidb member name
func TiDBPeerMemberName ¶ added in v0.2.0
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 ¶
TiKVMemberName returns tikv member name
func TiKVPeerMemberName ¶
TiKVPeerMemberName returns tikv peer service name
Types ¶
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) 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) GetStores ¶
func (pc *FakePDClient) GetStores() (*StoresInfo, error)
func (*FakePDClient) GetTombStoneStores ¶
func (pc *FakePDClient) GetTombStoneStores() (*StoresInfo, error)
func (*FakePDClient) SetStoreLabels ¶
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 ¶
FakePVCControl is a fake PVCControlInterface
func NewFakePVCControl ¶
func NewFakePVCControl(pvcInformer coreinformers.PersistentVolumeClaimInformer) *FakePVCControl
NewFakePVCControl returns a FakePVCControl
func (*FakePVCControl) DeletePVC ¶
func (fpc *FakePVCControl) DeletePVC(_ *v1alpha1.TidbCluster, pvc *corev1.PersistentVolumeClaim) error
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 ¶
func (fpc *FakePVCControl) UpdateMetaInfo(_ *v1alpha1.TidbCluster, pvc *corev1.PersistentVolumeClaim, pod *corev1.Pod) (*corev1.PersistentVolumeClaim, error)
UpdateMetaInfo updates the meta info of pvc
func (*FakePVCControl) UpdatePVC ¶
func (fpc *FakePVCControl) UpdatePVC(_ *v1alpha1.TidbCluster, pvc *corev1.PersistentVolumeClaim) (*corev1.PersistentVolumeClaim, error)
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 ¶
func NewFakePVControl(pvInformer coreinformers.PersistentVolumeInformer, pvcInformer coreinformers.PersistentVolumeClaimInformer) *FakePVControl
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 ¶
func (fpc *FakePVControl) UpdateMetaInfo(tc *v1alpha1.TidbCluster, pv *corev1.PersistentVolume) (*corev1.PersistentVolume, error)
UpdateMetaInfo update the meta info of pv
type FakePodControl ¶
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
func (ssc *FakeTidbClusterControl) UpdateTidbCluster(tc *v1alpha1.TidbCluster, _ *v1alpha1.TidbClusterStatus, _ *v1alpha1.TidbClusterStatus) (*v1alpha1.TidbCluster, error)
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 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
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 ¶
type PVCControlInterface interface {
UpdateMetaInfo(*v1alpha1.TidbCluster, *corev1.PersistentVolumeClaim, *corev1.Pod) (*corev1.PersistentVolumeClaim, error)
UpdatePVC(*v1alpha1.TidbCluster, *corev1.PersistentVolumeClaim) (*corev1.PersistentVolumeClaim, error)
DeletePVC(*v1alpha1.TidbCluster, *corev1.PersistentVolumeClaim) error
}
PVCControlInterface manages PVCs used in TidbCluster
func NewRealPVCControl ¶
func NewRealPVCControl( kubeCli kubernetes.Interface, recorder record.EventRecorder, pvcLister corelisters.PersistentVolumeClaimLister) PVCControlInterface
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 ¶
func NewRealPVControl( kubeCli kubernetes.Interface, pvcLister corelisters.PersistentVolumeClaimLister, pvLister corelisters.PersistentVolumeLister, recorder record.EventRecorder, ) PVControlInterface
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 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 ¶
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