Documentation ¶
Index ¶
- Constants
- Variables
- func AnnAdditionalProm(name string, port int32) map[string]string
- func AnnProm(port int32, path string) map[string]string
- func ContainerResource(req corev1.ResourceRequirements) corev1.ResourceRequirements
- func DMMasterMemberName(clusterName string) string
- func DMMasterPeerMemberName(clusterName string) string
- func DMWorkerMemberName(clusterName string) string
- func DMWorkerPeerMemberName(clusterName string) string
- func DeepCopyClientObject(input client.Object) client.Object
- func DeploymentPodSpecChanged(newDep *appsv1.Deployment, oldDep *appsv1.Deployment) bool
- func DiscoveryMemberName(clusterName string) string
- func EmptyClone(obj client.Object) (client.Object, error)
- func FormatClusterDomain(clusterDomain string) string
- func FormatClusterDomainForRegex(clusterDomain string) string
- func GetBackupOwnerRef(backup *v1alpha1.Backup) metav1.OwnerReference
- func GetBackupScheduleOwnerRef(bs *v1alpha1.BackupSchedule) metav1.OwnerReference
- func GetDMOwnerRef(dc *v1alpha1.DMCluster) metav1.OwnerReference
- func GetDeploymentLastAppliedPodTemplate(dep *appsv1.Deployment) (*corev1.PodSpec, error)
- func GetMasterClient(dmControl dmapi.MasterControlInterface, dc *v1alpha1.DMCluster) dmapi.MasterClient
- func GetMasterPeerClient(dmControl dmapi.MasterControlInterface, dc *v1alpha1.DMCluster, podName string) dmapi.MasterClient
- func GetOwnerRef(tc *v1alpha1.TidbCluster) metav1.OwnerReference
- func GetPDClient(pdControl pdapi.PDControlInterface, tc *v1alpha1.TidbCluster) pdapi.PDClient
- func GetRestoreOwnerRef(restore *v1alpha1.Restore) metav1.OwnerReference
- func GetServiceType(services []v1alpha1.Service, serviceName string) corev1.ServiceType
- func GetTiDBClusterAutoScalerOwnerRef(tac *v1alpha1.TidbClusterAutoScaler) metav1.OwnerReference
- func GetTiDBDashboardOwnerRef(td *v1alpha1.TidbDashboard) metav1.OwnerReference
- func GetTiDBMonitorOwnerRef(monitor *v1alpha1.TidbMonitor) metav1.OwnerReference
- func GetTiDBNGMonitoringOwnerRef(tngm *v1alpha1.TidbNGMonitoring) metav1.OwnerReference
- func GuaranteedUpdate(cli client.Client, obj client.Object, updateFunc func() error) error
- func IgnoreErrorf(format string, a ...interface{}) error
- func InferObjectKind(obj runtime.Object) (schema.GroupVersionKind, error)
- func IngressEqual(newIngress, oldIngres *networkingv1.Ingress) (bool, error)
- func IngressV1beta1Equal(newIngress, oldIngres *extensionsv1beta1.Ingress) (bool, error)
- func IsIgnoreError(err error) bool
- func IsRequeueError(err error) bool
- func MemberConfigMapName(tc *v1alpha1.TidbCluster, member v1alpha1.MemberType) string
- func MemberName(clusterName string, member v1alpha1.MemberType) string
- func NewControllerRateLimiter(baseDelay, maxDelay time.Duration) wq.RateLimiter
- func NewDefaultTiCDCControl(secretLister corelisterv1.SecretLister) *defaultTiCDCControl
- func NewDefaultTiDBControl(secretLister corelisterv1.SecretLister) *defaultTiDBControl
- func NewDefaultTiProxyControl(secretLister corelisterv1.SecretLister) *defaultTiProxyControl
- func NewFakeMasterClient(dmControl *dmapi.FakeMasterControl, dc *v1alpha1.DMCluster) *dmapi.FakeMasterClient
- func NewFakeMasterPeerClient(dmControl *dmapi.FakeMasterControl, dc *v1alpha1.DMCluster, podName string) *dmapi.FakeMasterClient
- func NewFakePDClient(pdControl *pdapi.FakePDControl, tc *v1alpha1.TidbCluster) *pdapi.FakePDClient
- func NewFakePDClientWithAddress(pdControl *pdapi.FakePDControl, peerURL string) *pdapi.FakePDClient
- func NewFakeTiKVClient(tikvControl *tikvapi.FakeTiKVControl, tc *v1alpha1.TidbCluster, podName string) *tikvapi.FakeTiKVClient
- func PDMemberName(clusterName string) string
- func PDPeerFullyDomain(name, ns, clusterDomain string) string
- func PDPeerMemberName(clusterName string) string
- func ParseStorageRequest(req corev1.ResourceList) (corev1.ResourceRequirements, error)
- func PumpMemberName(clusterName string) string
- func PumpPeerMemberName(clusterName string) string
- func RequeueErrorf(format string, a ...interface{}) error
- func ServiceEqual(newSvc, oldSvc *corev1.Service) (bool, error)
- func SetServiceLastAppliedConfigAnnotation(svc *corev1.Service) error
- func TiCDCMemberName(clusterName string) string
- func TiCDCPeerMemberName(clusterName string) string
- func TiDBInitSecret(clusterName string) string
- func TiDBInitializerMemberName(clusterName string) string
- func TiDBMemberName(clusterName string) string
- func TiDBPeerMemberName(clusterName string) string
- func TiFlashMemberName(clusterName string) string
- func TiFlashPeerMemberName(clusterName string) string
- func TiKVCapacity(limits corev1.ResourceList) string
- func TiKVMemberName(clusterName string) string
- func TiKVPeerMemberName(clusterName string) string
- func TiProxyMemberName(clusterName string) string
- func TiProxyPeerMemberName(clusterName string) string
- func WatchForController(informer cache.SharedIndexInformer, q workqueue.Interface, fn GetControllerFn, ...)
- func WatchForObject(informer cache.SharedIndexInformer, q workqueue.Interface)
- type BackupConditionUpdaterInterface
- type BackupControlInterface
- type BackupScheduleStatusUpdaterInterface
- type BackupUpdateStatus
- type CLIConfig
- type CaptureStatus
- type ConfigMapControlInterface
- type Controls
- type DBInfo
- type DMClusterControlInterface
- type Dependencies
- type FakeBackupConditionUpdater
- type FakeBackupControl
- func (fbc *FakeBackupControl) CreateBackup(backup *v1alpha1.Backup) (*v1alpha1.Backup, error)
- func (fbc *FakeBackupControl) DeleteBackup(backup *v1alpha1.Backup) error
- func (fbc *FakeBackupControl) SetCreateBackupError(err error, after int)
- func (fbc *FakeBackupControl) SetDeleteBackupError(err error, after int)
- func (fbc *FakeBackupControl) TruncateLogBackup(backup *v1alpha1.Backup, truncateTSO uint64) error
- type FakeBackupScheduleStatusUpdater
- type FakeConfigMapControl
- func (c *FakeConfigMapControl) CreateConfigMap(_ runtime.Object, cm *corev1.ConfigMap) (*corev1.ConfigMap, error)
- func (c *FakeConfigMapControl) DeleteConfigMap(_ runtime.Object, _ *corev1.ConfigMap) error
- func (c *FakeConfigMapControl) GetConfigMap(controller runtime.Object, cm *corev1.ConfigMap) (*corev1.ConfigMap, error)
- func (c *FakeConfigMapControl) SetCreateConfigMapError(err error, after int)
- func (c *FakeConfigMapControl) SetDeleteConfigMapError(err error, after int)
- func (c *FakeConfigMapControl) SetUpdateConfigMapError(err error, after int)
- func (c *FakeConfigMapControl) UpdateConfigMap(_ runtime.Object, cm *corev1.ConfigMap) (*corev1.ConfigMap, error)
- type FakeDMClusterControl
- type FakeGeneralPVCControl
- type FakeGenericControl
- func (c *FakeGenericControl) AddObject(object client.Object) error
- func (c *FakeGenericControl) Create(controller, obj client.Object, setOwnerFlag bool) error
- func (c *FakeGenericControl) CreateOrUpdate(controller, obj client.Object, fn MergeFn, setOwnerFlag bool) (runtime.Object, error)
- func (c *FakeGenericControl) Delete(controller, obj client.Object) error
- func (c *FakeGenericControl) Exist(key client.ObjectKey, obj client.Object) (bool, error)
- func (c *FakeGenericControl) SetCreateError(err error, after int)
- func (c *FakeGenericControl) SetCreateOrUpdateError(err error, after int)
- func (c *FakeGenericControl) SetDeleteError(err error, after int)
- func (c *FakeGenericControl) SetExistError(err error, after int)
- func (c *FakeGenericControl) SetUpdateStatusError(err error, after int)
- func (c *FakeGenericControl) UpdateStatus(obj client.Object) error
- type FakeJobControl
- type FakePVCControl
- func (c *FakePVCControl) CreatePVC(_ runtime.Object, pvc *corev1.PersistentVolumeClaim) error
- func (c *FakePVCControl) DeletePVC(_ runtime.Object, pvc *corev1.PersistentVolumeClaim) error
- func (c *FakePVCControl) GetPVC(name, namespace string) (*corev1.PersistentVolumeClaim, error)
- func (c *FakePVCControl) SetDeletePVCError(err error, after int)
- func (c *FakePVCControl) SetUpdatePVCError(err error, after int)
- func (c *FakePVCControl) UpdateMetaInfo(_ runtime.Object, pvc *corev1.PersistentVolumeClaim, pod *corev1.Pod) (*corev1.PersistentVolumeClaim, error)
- func (c *FakePVCControl) UpdatePVC(_ runtime.Object, pvc *corev1.PersistentVolumeClaim) (*corev1.PersistentVolumeClaim, error)
- type FakePVControl
- func (c *FakePVControl) CreatePV(_ runtime.Object, pv *corev1.PersistentVolume) error
- func (c *FakePVControl) GetPV(name string) (*corev1.PersistentVolume, error)
- func (c *FakePVControl) PatchPVClaimRef(obj runtime.Object, pv *corev1.PersistentVolume, pvcName string) error
- func (c *FakePVControl) PatchPVReclaimPolicy(_ runtime.Object, pv *corev1.PersistentVolume, ...) error
- func (c *FakePVControl) SetUpdatePVError(err error, after int)
- func (c *FakePVControl) UpdateMetaInfo(obj runtime.Object, pv *corev1.PersistentVolume) (*corev1.PersistentVolume, error)
- type FakePodControl
- func (c *FakePodControl) DeletePod(_ runtime.Object, pod *corev1.Pod) error
- func (c *FakePodControl) ForceDeletePod(rObj runtime.Object, pod *corev1.Pod) error
- func (c *FakePodControl) SetDeletePodError(err error, after int)
- func (c *FakePodControl) SetGetClusterError(err error, after int)
- func (c *FakePodControl) SetGetMemberError(err error, after int)
- func (c *FakePodControl) SetGetStoreError(err error, after int)
- func (c *FakePodControl) SetUpdatePodError(err error, after int)
- func (c *FakePodControl) UpdateMetaInfo(_ *v1alpha1.TidbCluster, pod *corev1.Pod) (*corev1.Pod, error)
- func (c *FakePodControl) UpdatePod(_ runtime.Object, pod *corev1.Pod) (*corev1.Pod, error)
- type FakeRestoreConditionUpdater
- type FakeRestoreControl
- type FakeSecretControl
- type FakeServiceControl
- func (c *FakeServiceControl) CreateService(_ runtime.Object, svc *corev1.Service) error
- func (c *FakeServiceControl) DeleteService(_ runtime.Object, _ *corev1.Service) error
- func (c *FakeServiceControl) SetCreateServiceError(err error, after int)
- func (c *FakeServiceControl) SetDeleteServiceError(err error, after int)
- func (c *FakeServiceControl) SetUpdateServiceError(err error, after int)
- func (c *FakeServiceControl) UpdateService(_ runtime.Object, svc *corev1.Service) (*corev1.Service, error)
- type FakeStatefulSetControl
- func (c *FakeStatefulSetControl) CreateStatefulSet(controller runtime.Object, set *apps.StatefulSet) error
- func (c *FakeStatefulSetControl) DeleteStatefulSet(_ runtime.Object, _ *apps.StatefulSet) error
- func (c *FakeStatefulSetControl) SetCreateStatefulSetError(err error, after int)
- func (c *FakeStatefulSetControl) SetDeleteStatefulSetError(err error, after int)
- func (c *FakeStatefulSetControl) SetStatusChange(fn func(*apps.StatefulSet))
- func (c *FakeStatefulSetControl) SetUpdateStatefulSetError(err error, after int)
- func (c *FakeStatefulSetControl) UpdateStatefulSet(_ runtime.Object, set *apps.StatefulSet) (*apps.StatefulSet, error)
- type FakeTiCDCControl
- func (c *FakeTiCDCControl) DrainCapture(tc *v1alpha1.TidbCluster, ordinal int32) (tableCount int, retry bool, err error)
- func (c *FakeTiCDCControl) GetStatus(tc *v1alpha1.TidbCluster, ordinal int32) (*CaptureStatus, error)
- func (c *FakeTiCDCControl) IsHealthy(tc *v1alpha1.TidbCluster, ordinal int32) (bool, error)
- func (c *FakeTiCDCControl) ResignOwner(tc *v1alpha1.TidbCluster, ordinal int32) (ok bool, err error)
- type FakeTiDBControl
- func (c *FakeTiDBControl) GetHealth(tc *v1alpha1.TidbCluster, ordinal int32) (bool, error)
- func (c *FakeTiDBControl) GetInfo(tc *v1alpha1.TidbCluster, ordinal int32) (*DBInfo, error)
- func (c *FakeTiDBControl) SetHealth(healthInfo map[string]bool)
- func (c *FakeTiDBControl) SetLabelsErr(err error)
- func (c *FakeTiDBControl) SetServerLabels(tc *v1alpha1.TidbCluster, ordinal int32, labels map[string]string) error
- type FakeTidbClusterControl
- func (c *FakeTidbClusterControl) Create(tc *v1alpha1.TidbCluster) error
- func (c *FakeTidbClusterControl) Patch(tc *v1alpha1.TidbCluster, data []byte, subresources ...string) (result *v1alpha1.TidbCluster, err error)
- func (c *FakeTidbClusterControl) SetUpdateTidbClusterError(err error, after int)
- func (c *FakeTidbClusterControl) Update(tc *v1alpha1.TidbCluster) (*v1alpha1.TidbCluster, error)
- func (c *FakeTidbClusterControl) UpdateTidbCluster(tc *v1alpha1.TidbCluster, _ *v1alpha1.TidbClusterStatus, ...) (*v1alpha1.TidbCluster, error)
- type GeneralPVCControlInterface
- type GenericControlInterface
- type GetControllerFn
- type IgnoreError
- type JobControlInterface
- type MergeFn
- type PVCControlInterface
- type PVControlInterface
- type PodControlInterface
- type RequestTracker
- func (rt *RequestTracker) ErrorReady() bool
- func (rt *RequestTracker) GetError() error
- func (rt *RequestTracker) GetRequests() int
- func (rt *RequestTracker) Inc()
- func (rt *RequestTracker) Reset()
- func (rt *RequestTracker) SetAfter(after int) *RequestTracker
- func (rt *RequestTracker) SetError(err error) *RequestTracker
- func (rt *RequestTracker) SetRequests(requests int) *RequestTracker
- type RequeueError
- type RestoreConditionUpdaterInterface
- type RestoreControlInterface
- type RestoreUpdateStatus
- type SecretControlInterface
- type ServiceControlInterface
- type StatefulSetControlInterface
- type TiCDCControlInterface
- type TiDBControlInterface
- type TiProxyControlInterface
- type TidbClusterControlInterface
- type TypedControlInterface
Constants ¶
const ( // LastAppliedPodTemplate is annotation key of the last applied pod template LastAppliedPodTemplate = "pingcap.com/last-applied-podtemplate" // LastAppliedConfigAnnotation is annotation key of last applied configuration LastAppliedConfigAnnotation = "pingcap.com/last-applied-configuration" )
const ( // https://github.com/pingcap/tidb/blob/master/owner/manager.go#L183 // 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 ( // controllerKind contains the schema.GroupVersionKind for tidbcluster controller type. ControllerKind = v1alpha1.SchemeGroupVersion.WithKind("TidbCluster") // DMControllerKind contains the schema.GroupVersionKind for dmcluster controller type. DMControllerKind = v1alpha1.SchemeGroupVersion.WithKind("DMCluster") // BackupControllerKind contains the schema.GroupVersionKind for backup controller type. BackupControllerKind = v1alpha1.SchemeGroupVersion.WithKind("Backup") // RestoreControllerKind contains the schema.GroupVersionKind for restore controller type. RestoreControllerKind = v1alpha1.SchemeGroupVersion.WithKind("Restore") )
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 AnnAdditionalProm ¶ added in v1.1.0
AnnAdditionalProm adds additional prometheus scarping configuration annotation for the pod which has multiple metrics endpoint we assumes that the metrics path is as same as the previous metrics path
func ContainerResource ¶ added in v1.1.0
func ContainerResource(req corev1.ResourceRequirements) corev1.ResourceRequirements
func DMMasterMemberName ¶ added in v1.2.0
DMMasterMemberName returns dm-master member name
func DMMasterPeerMemberName ¶ added in v1.2.0
DMMasterPeerMemberName returns dm-master peer service name
func DMWorkerMemberName ¶ added in v1.2.0
DMWorkerMemberName returns dm-worker member name
func DMWorkerPeerMemberName ¶ added in v1.2.0
DMWorkerPeerMemberName returns dm-worker peer service name
func DeepCopyClientObject ¶ added in v1.3.0
func DeploymentPodSpecChanged ¶ added in v1.1.0
func DeploymentPodSpecChanged(newDep *appsv1.Deployment, oldDep *appsv1.Deployment) bool
DeploymentPodSpecChanged checks whether the new deployment differs with the old one's last-applied-config
func DiscoveryMemberName ¶ added in v1.1.0
DiscoveryMemberName returns the name of tidb discovery
func EmptyClone ¶ added in v1.1.0
EmptyClone create an clone of the resource with the same name and namespace (if namespace-scoped), with other fields unset
func FormatClusterDomain ¶ added in v1.2.0
func FormatClusterDomainForRegex ¶ added in v1.2.0
func GetBackupOwnerRef ¶ added in v1.1.0
func GetBackupOwnerRef(backup *v1alpha1.Backup) metav1.OwnerReference
GetBackupOwnerRef returns Backup's OwnerReference
func GetBackupScheduleOwnerRef ¶ added in v1.1.0
func GetBackupScheduleOwnerRef(bs *v1alpha1.BackupSchedule) metav1.OwnerReference
GetBackupScheduleOwnerRef returns BackupSchedule's OwnerReference
func GetDMOwnerRef ¶ added in v1.2.0
func GetDMOwnerRef(dc *v1alpha1.DMCluster) metav1.OwnerReference
GetDMOwnerRef returns DMCluster's OwnerReference
func GetDeploymentLastAppliedPodTemplate ¶ added in v1.1.0
func GetDeploymentLastAppliedPodTemplate(dep *appsv1.Deployment) (*corev1.PodSpec, error)
GetDeploymentLastAppliedPodTemplate set last applied pod template from Deployment's annotation
func GetMasterClient ¶ added in v1.2.0
func GetMasterClient(dmControl dmapi.MasterControlInterface, dc *v1alpha1.DMCluster) dmapi.MasterClient
GetMasterClient gets the master client from the DMCluster
func GetMasterPeerClient ¶ added in v1.2.0
func GetMasterPeerClient(dmControl dmapi.MasterControlInterface, dc *v1alpha1.DMCluster, podName string) dmapi.MasterClient
GetMasterClient gets the master client from the DMCluster
func GetOwnerRef ¶
func GetOwnerRef(tc *v1alpha1.TidbCluster) metav1.OwnerReference
GetOwnerRef returns TidbCluster's OwnerReference
func GetPDClient ¶ added in v1.0.0
func GetPDClient(pdControl pdapi.PDControlInterface, tc *v1alpha1.TidbCluster) pdapi.PDClient
GetPDClient tries to return an available PDClient If the pdClient built from the PD service name is unavailable, try to build another one with the ClientURL in the PeerMembers. ClientURL example: ClientURL: https://cluster2-pd-0.cluster2-pd-peer.pingcap.svc.cluster2.local
func GetRestoreOwnerRef ¶ added in v1.1.0
func GetRestoreOwnerRef(restore *v1alpha1.Restore) metav1.OwnerReference
GetRestoreOwnerRef returns Restore's OwnerReference
func GetServiceType ¶
func GetServiceType(services []v1alpha1.Service, serviceName string) corev1.ServiceType
GetServiceType returns member's service type
func GetTiDBClusterAutoScalerOwnerRef ¶ added in v1.2.0
func GetTiDBClusterAutoScalerOwnerRef(tac *v1alpha1.TidbClusterAutoScaler) metav1.OwnerReference
func GetTiDBDashboardOwnerRef ¶ added in v1.4.0
func GetTiDBDashboardOwnerRef(td *v1alpha1.TidbDashboard) metav1.OwnerReference
func GetTiDBMonitorOwnerRef ¶ added in v1.1.0
func GetTiDBMonitorOwnerRef(monitor *v1alpha1.TidbMonitor) metav1.OwnerReference
func GetTiDBNGMonitoringOwnerRef ¶ added in v1.3.0
func GetTiDBNGMonitoringOwnerRef(tngm *v1alpha1.TidbNGMonitoring) metav1.OwnerReference
func GuaranteedUpdate ¶ added in v1.1.0
GuaranteedUpdate will retry the updateFunc to mutate the object until success, updateFunc is expected to capture the object reference from the caller context to avoid unnecessary type casting.
func IgnoreErrorf ¶ added in v1.1.0
IgnoreErrorf returns a IgnoreError
func InferObjectKind ¶ added in v1.1.0
func InferObjectKind(obj runtime.Object) (schema.GroupVersionKind, error)
InferObjectKind infers the object kind
func IngressEqual ¶ added in v1.1.0
func IngressEqual(newIngress, oldIngres *networkingv1.Ingress) (bool, error)
func IngressV1beta1Equal ¶ added in v1.3.0
func IngressV1beta1Equal(newIngress, oldIngres *extensionsv1beta1.Ingress) (bool, error)
func IsIgnoreError ¶ added in v1.1.0
IsIgnoreError returns whether err is a IgnoreError
func IsRequeueError ¶ added in v0.2.1
IsRequeueError returns whether err is a RequeueError
func MemberConfigMapName ¶ added in v1.0.0
func MemberConfigMapName(tc *v1alpha1.TidbCluster, member v1alpha1.MemberType) string
MemberConfigMapName returns the default ConfigMap name of the specified member type Deprecated TODO: remove after helm get totally abandoned
func MemberName ¶ added in v1.3.7
func MemberName(clusterName string, member v1alpha1.MemberType) string
MemberName return a component member name
func NewControllerRateLimiter ¶ added in v1.1.10
func NewControllerRateLimiter(baseDelay, maxDelay time.Duration) wq.RateLimiter
NewControllerRateLimiter returns a RateLimiter, which limit the request rate by the stricter one's desicion of two RateLimiters: ItemExponentialFailureRateLimiter and BucketRateLimiter
func NewDefaultTiCDCControl ¶ added in v1.1.0
func NewDefaultTiCDCControl(secretLister corelisterv1.SecretLister) *defaultTiCDCControl
NewDefaultTiCDCControl returns a defaultTiCDCControl instance
func NewDefaultTiDBControl ¶ added in v0.2.0
func NewDefaultTiDBControl(secretLister corelisterv1.SecretLister) *defaultTiDBControl
NewDefaultTiDBControl returns a defaultTiDBControl instance
func NewDefaultTiProxyControl ¶ added in v1.4.0
func NewDefaultTiProxyControl(secretLister corelisterv1.SecretLister) *defaultTiProxyControl
NewDefaultTiProxyControl returns a defaultTiProxyControl instance
func NewFakeMasterClient ¶ added in v1.2.0
func NewFakeMasterClient(dmControl *dmapi.FakeMasterControl, dc *v1alpha1.DMCluster) *dmapi.FakeMasterClient
NewFakeMasterClient creates a fake master client that is set as the master client
func NewFakeMasterPeerClient ¶ added in v1.2.0
func NewFakeMasterPeerClient(dmControl *dmapi.FakeMasterControl, dc *v1alpha1.DMCluster, podName string) *dmapi.FakeMasterClient
func NewFakePDClient ¶
func NewFakePDClient(pdControl *pdapi.FakePDControl, tc *v1alpha1.TidbCluster) *pdapi.FakePDClient
NewFakePDClient creates a fake pdclient that is set as the pd client
func NewFakePDClientWithAddress ¶ added in v1.2.0
func NewFakePDClientWithAddress(pdControl *pdapi.FakePDControl, peerURL string) *pdapi.FakePDClient
NewFakePDClient creates a fake pdclient that is set as the pd client
func NewFakeTiKVClient ¶ added in v1.1.11
func NewFakeTiKVClient(tikvControl *tikvapi.FakeTiKVControl, tc *v1alpha1.TidbCluster, podName string) *tikvapi.FakeTiKVClient
NewFakeTiKVClient creates a fake tikvclient that is set as the tikv client
func PDMemberName ¶
PDMemberName returns pd member name
func PDPeerFullyDomain ¶ added in v1.3.0
func PDPeerMemberName ¶
PDPeerMemberName returns pd peer service name
func ParseStorageRequest ¶ added in v1.1.0
func ParseStorageRequest(req corev1.ResourceList) (corev1.ResourceRequirements, error)
func PumpMemberName ¶ added in v1.1.0
PumpMemberName returns pump member name
func PumpPeerMemberName ¶ added in v1.1.0
For backward compatibility, pump peer member name do not has -peer suffix PumpPeerMemberName returns pump peer service name
func RequeueErrorf ¶ added in v0.2.1
RequeueErrorf returns a RequeueError
func ServiceEqual ¶ added in v1.1.0
ServiceEqual compares the new Service's spec with old Service's last applied config
func SetServiceLastAppliedConfigAnnotation ¶ added in v1.1.0
SetServiceLastAppliedConfigAnnotation set last applied config info to Service's annotation
func TiCDCMemberName ¶ added in v1.1.0
TiCDCMemberName returns ticdc member name
func TiCDCPeerMemberName ¶ added in v1.1.0
TiCDCPeerMemberName returns ticdc peer service name
func TiDBInitSecret ¶ added in v1.3.0
TiDBInitSecret returns tidb init secret name
func TiDBInitializerMemberName ¶ added in v1.1.0
TiDBInitializerMemberName returns TiDBInitializer member name
func TiDBMemberName ¶
TiDBMemberName returns tidb member name
func TiDBPeerMemberName ¶ added in v0.2.0
TiDBPeerMemberName returns tidb peer service name
func TiFlashMemberName ¶ added in v1.1.0
TiFlashMemberName returns tiflash member name
func TiFlashPeerMemberName ¶ added in v1.1.0
TiFlashPeerMemberName returns tiflash peer service name
func TiKVCapacity ¶
func TiKVCapacity(limits corev1.ResourceList) string
TiKVCapacity returns string resource requirement. In tikv-server, KB/MB/GB equal to MiB/GiB/TiB, so we cannot use resource.String() directly. Minimum unit we use is MiB, capacity less than 1MiB is ignored. https://github.com/tikv/tikv/blob/v3.0.3/components/tikv_util/src/config.rs#L155-L168 For backward compatibility with old TiKV versions, we should use GB/MB rather than GiB/MiB, see https://github.com/tikv/tikv/blob/v2.1.16/src/util/config.rs#L359.
func TiKVMemberName ¶
TiKVMemberName returns tikv member name
func TiKVPeerMemberName ¶
TiKVPeerMemberName returns tikv peer service name
func TiProxyMemberName ¶ added in v1.4.0
TiProxyMemberName returns tiproxy member name
func TiProxyPeerMemberName ¶ added in v1.4.0
TiProxyPeerMemberName returns tiproxy peer service name
func WatchForController ¶ added in v1.1.0
func WatchForController(informer cache.SharedIndexInformer, q workqueue.Interface, fn GetControllerFn, m map[string]string)
WatchForController watch the object change from informer and add it's controller to workqueue
func WatchForObject ¶ added in v1.1.0
func WatchForObject(informer cache.SharedIndexInformer, q workqueue.Interface)
WacthForObject watch the object change from informer and add it to workqueue
Types ¶
type BackupConditionUpdaterInterface ¶ added in v1.1.0
type BackupConditionUpdaterInterface interface {
Update(backup *v1alpha1.Backup, condition *v1alpha1.BackupCondition, newStatus *BackupUpdateStatus) error
}
BackupConditionUpdaterInterface enables updating Backup conditions.
func NewRealBackupConditionUpdater ¶ added in v1.1.0
func NewRealBackupConditionUpdater( cli versioned.Interface, backupLister listers.BackupLister, recorder record.EventRecorder) BackupConditionUpdaterInterface
returns a BackupConditionUpdaterInterface that updates the Status of a Backup,
type BackupControlInterface ¶ added in v1.1.0
type BackupControlInterface interface { CreateBackup(backup *v1alpha1.Backup) (*v1alpha1.Backup, error) DeleteBackup(backup *v1alpha1.Backup) error TruncateLogBackup(logBackup *v1alpha1.Backup, truncateTSO uint64) error }
BackupControlInterface manages Backups used in BackupSchedule
func NewRealBackupControl ¶ added in v1.1.0
func NewRealBackupControl( cli versioned.Interface, recorder record.EventRecorder, ) BackupControlInterface
NewRealBackupControl creates a new BackupControlInterface
type BackupScheduleStatusUpdaterInterface ¶ added in v1.1.0
type BackupScheduleStatusUpdaterInterface interface { // UpdateBackupScheduleStatus sets the backupSchedule's Status to status. Implementations are required to retry on conflicts, // but fail on other errors. If the returned error is nil backup's Status has been successfully set to status. UpdateBackupScheduleStatus(*v1alpha1.BackupSchedule, *v1alpha1.BackupScheduleStatus, *v1alpha1.BackupScheduleStatus) error }
BackupScheduleStatusUpdaterInterface is an interface used to update the BackupScheduleStatus associated with a BackupSchedule. For any use other than testing, clients should create an instance using NewRealBackupScheduleStatusUpdater.
func NewRealBackupScheduleStatusUpdater ¶ added in v1.1.0
func NewRealBackupScheduleStatusUpdater(deps *Dependencies) BackupScheduleStatusUpdaterInterface
returns a BackupScheduleStatusUpdaterInterface that updates the Status of a BackupSchedule, using the supplied client and bsLister.
type BackupUpdateStatus ¶ added in v1.1.10
type BackupUpdateStatus struct { // BackupPath is the location of the backup. BackupPath *string // TimeStarted is the time at which the backup was started. TimeStarted *metav1.Time // TimeCompleted is the time at which the backup was completed. TimeCompleted *metav1.Time // BackupSizeReadable is the data size of the backup. // the difference with BackupSize is that its format is human readable BackupSizeReadable *string // BackupSize is the data size of the backup. BackupSize *int64 // CommitTs is the snapshot time point of tidb cluster. CommitTs *string // LogCheckpointTs is the ts of log backup process. LogCheckpointTs *string // LogSuccessTruncateUntil is log backup already successfully truncate until timestamp. LogSuccessTruncateUntil *string // LogTruncatingUntil is log backup truncate until timestamp which is used to mark the truncate command. LogTruncatingUntil *string // ProgressStep the step name of progress. ProgressStep *string // Progress is the step's progress value. Progress *float64 // ProgressUpdateTime is the progress update time. ProgressUpdateTime *metav1.Time // RetryNum is the number of retry RetryNum *int // DetectFailedAt is the time when detect failure DetectFailedAt *metav1.Time // ExpectedRetryAt is the time we calculate and expect retry after it ExpectedRetryAt *metav1.Time // RealRetryAt is the time when the retry was actually initiated RealRetryAt *metav1.Time // Reason is the reason of retry RetryReason *string // OriginalReason is the original reason of backup job or pod failed OriginalReason *string }
BackupUpdateStatus represents the status of a backup to be updated. This structure should keep synced with the fields in `BackupStatus` except for `Phase` and `Conditions`.
type CLIConfig ¶ added in v1.1.6
type CLIConfig struct { PrintVersion bool // The number of workers that are allowed to sync concurrently. // Larger number = more responsive management, but more CPU // (and network) load Workers int // Controls whether operator should manage kubernetes cluster // wide TiDB clusters ClusterScoped bool ClusterPermissionNode bool ClusterPermissionPV bool ClusterPermissionSC bool AutoFailover bool PDFailoverPeriod time.Duration TiKVFailoverPeriod time.Duration TiDBFailoverPeriod time.Duration TiFlashFailoverPeriod time.Duration MasterFailoverPeriod time.Duration WorkerFailoverPeriod time.Duration LeaseDuration time.Duration RenewDeadline time.Duration RetryPeriod time.Duration WaitDuration time.Duration // ResyncDuration is the resync time of informer ResyncDuration time.Duration // DetectNodeFailure enables detection of node failures for stateful failure pods for recovery DetectNodeFailure bool // PodHardRecoveryPeriod is the hard recovery period for a failure pod PodHardRecoveryPeriod time.Duration // Defines whether tidb operator run in test mode, test mode is // only open when test TestMode bool TiDBBackupManagerImage string TiDBDiscoveryImage string // Selector is used to filter CR labels to decide // what resources should be watched and synced by controller Selector string // KubeClientQPS indicates the maximum QPS to the kubenetes API server from client. KubeClientQPS float64 KubeClientBurst int }
CLIConfig is used save all configuration read from command line parameters
func DefaultCLIConfig ¶ added in v1.1.6
func DefaultCLIConfig() *CLIConfig
DefaultCLIConfig returns the default command line configuration
func (*CLIConfig) AddFlag ¶ added in v1.1.6
AddFlag adds a flag for setting global feature gates to the specified FlagSet.
func (*CLIConfig) HasNodePermission ¶ added in v1.2.0
HasNodePermission returns whether the user has permission for node operations.
func (*CLIConfig) HasPVPermission ¶ added in v1.2.0
HasPVPermission returns whether the user has permission for persistent volume operations.
func (*CLIConfig) HasSCPermission ¶ added in v1.2.0
HasSCPermission returns whether the user has permission for storage class operations.
type CaptureStatus ¶ added in v1.1.0
type ConfigMapControlInterface ¶ added in v1.1.0
type ConfigMapControlInterface interface { // CreateConfigMap create the given ConfigMap owned by the controller object CreateConfigMap(controller runtime.Object, cm *corev1.ConfigMap) (*corev1.ConfigMap, error) // UpdateConfigMap continuously tries to update ConfigMap to the given state owned by the controller obejct UpdateConfigMap(controller runtime.Object, cm *corev1.ConfigMap) (*corev1.ConfigMap, error) // DeleteConfigMap delete the given ConfigMap owned by the controller object DeleteConfigMap(controller runtime.Object, cm *corev1.ConfigMap) error // GetConfigMap get the ConfigMap by configMap name GetConfigMap(controller runtime.Object, cm *corev1.ConfigMap) (*corev1.ConfigMap, error) }
ConfigMapControlInterface manages configmaps used by TiDB clusters
func NewRealConfigMapControl ¶ added in v1.1.0
func NewRealConfigMapControl( kubeCli kubernetes.Interface, recorder record.EventRecorder, ) ConfigMapControlInterface
NewRealSecretControl creates a new SecretControlInterface
type Controls ¶ added in v1.1.6
type Controls struct { JobControl JobControlInterface ConfigMapControl ConfigMapControlInterface StatefulSetControl StatefulSetControlInterface ServiceControl ServiceControlInterface PVCControl PVCControlInterface GeneralPVCControl GeneralPVCControlInterface GenericControl GenericControlInterface PVControl PVControlInterface PodControl PodControlInterface TypedControl TypedControlInterface PDControl pdapi.PDControlInterface TiKVControl tikvapi.TiKVControlInterface TiFlashControl tiflashapi.TiFlashControlInterface DMMasterControl dmapi.MasterControlInterface TiDBClusterControl TidbClusterControlInterface DMClusterControl DMClusterControlInterface CDCControl TiCDCControlInterface ProxyControl TiProxyControlInterface TiDBControl TiDBControlInterface BackupControl BackupControlInterface RestoreControl RestoreControlInterface SecretControl SecretControlInterface }
type DMClusterControlInterface ¶ added in v1.2.0
type DMClusterControlInterface interface {
UpdateDMCluster(*v1alpha1.DMCluster, *v1alpha1.DMClusterStatus, *v1alpha1.DMClusterStatus) (*v1alpha1.DMCluster, error)
}
DMClusterControlInterface manages DMClusters
func NewRealDMClusterControl ¶ added in v1.2.0
func NewRealDMClusterControl(cli versioned.Interface, dcLister listers.DMClusterLister, recorder record.EventRecorder) DMClusterControlInterface
NewRealDMClusterControl creates a new DMClusterControlInterface
type Dependencies ¶ added in v1.1.6
type Dependencies struct { // CLIConfig represents all parameters read from command line CLIConfig *CLIConfig // Operator client interface Clientset versioned.Interface // Kubernetes client interface KubeClientset kubernetes.Interface GenericClient client.Client InformerFactory informers.SharedInformerFactory KubeInformerFactory kubeinformers.SharedInformerFactory LabelFilterKubeInformerFactory kubeinformers.SharedInformerFactory Recorder record.EventRecorder // Listers ServiceLister corelisterv1.ServiceLister EndpointLister corelisterv1.EndpointsLister PVCLister corelisterv1.PersistentVolumeClaimLister PVLister corelisterv1.PersistentVolumeLister PodLister corelisterv1.PodLister NodeLister corelisterv1.NodeLister SecretLister corelisterv1.SecretLister ConfigMapLister corelisterv1.ConfigMapLister StatefulSetLister appslisters.StatefulSetLister DeploymentLister appslisters.DeploymentLister JobLister batchlisters.JobLister IngressLister networklister.IngressLister IngressV1Beta1Lister extensionslister.IngressLister // in order to be compatibility with kubernetes which less than v1.19 StorageClassLister storagelister.StorageClassLister TiDBClusterLister listers.TidbClusterLister TiDBClusterAutoScalerLister listers.TidbClusterAutoScalerLister DMClusterLister listers.DMClusterLister BackupLister listers.BackupLister RestoreLister listers.RestoreLister BackupScheduleLister listers.BackupScheduleLister TiDBInitializerLister listers.TidbInitializerLister TiDBMonitorLister listers.TidbMonitorLister TiDBNGMonitoringLister listers.TidbNGMonitoringLister TiDBDashboardLister listers.TidbDashboardLister // Controls Controls AWSConfig aws.Config }
Dependencies is used to store all shared dependent resources to avoid pass parameters everywhere.
func NewDependencies ¶ added in v1.1.6
func NewDependencies(ns string, cliCfg *CLIConfig, clientset versioned.Interface, kubeClientset kubernetes.Interface, genericCli client.Client) (*Dependencies, error)
NewDependencies is used to construct the dependencies
func NewFakeDependencies ¶ added in v1.1.6
func NewFakeDependencies() *Dependencies
NewFakeDependencies returns a fake dependencies for testing
func NewSimpleClientDependencies ¶ added in v1.1.7
func NewSimpleClientDependencies() *Dependencies
NewSimpleClientDependencies returns a dependencies using NewSimpleClientset useful for testing.
type FakeBackupConditionUpdater ¶ added in v1.1.0
type FakeBackupConditionUpdater struct { BackupLister listers.BackupLister BackupIndexer cache.Indexer // contains filtered or unexported fields }
FakeBackupConditionUpdater is a fake BackupConditionUpdaterInterface
func NewFakeBackupConditionUpdater ¶ added in v1.1.0
func NewFakeBackupConditionUpdater(backupInformer informers.BackupInformer) *FakeBackupConditionUpdater
NewFakeBackupConditionUpdater returns a FakeBackupConditionUpdater
func (*FakeBackupConditionUpdater) SetUpdateBackupError ¶ added in v1.1.0
func (c *FakeBackupConditionUpdater) SetUpdateBackupError(err error, after int)
SetUpdateBackupError sets the error attributes of updateBackupTracker
func (*FakeBackupConditionUpdater) Update ¶ added in v1.1.0
func (c *FakeBackupConditionUpdater) Update(backup *v1alpha1.Backup, _ *v1alpha1.BackupCondition, _ *BackupUpdateStatus) error
UpdateBackup updates the Backup
type FakeBackupControl ¶ added in v1.1.0
type FakeBackupControl struct {
// contains filtered or unexported fields
}
FakeBackupControl is a fake BackupControlInterface
func NewFakeBackupControl ¶ added in v1.1.0
func NewFakeBackupControl(backupInformer informers.BackupInformer) *FakeBackupControl
NewFakeBackupControl returns a FakeBackupControl
func (*FakeBackupControl) CreateBackup ¶ added in v1.1.0
CreateBackup adds the backup to BackupIndexer
func (*FakeBackupControl) DeleteBackup ¶ added in v1.1.0
func (fbc *FakeBackupControl) DeleteBackup(backup *v1alpha1.Backup) error
DeleteBackup deletes the backup from BackupIndexer
func (*FakeBackupControl) SetCreateBackupError ¶ added in v1.1.0
func (fbc *FakeBackupControl) SetCreateBackupError(err error, after int)
SetCreateBackupError sets the error attributes of createBackupTracker
func (*FakeBackupControl) SetDeleteBackupError ¶ added in v1.1.0
func (fbc *FakeBackupControl) SetDeleteBackupError(err error, after int)
SetDeleteBackupError sets the error attributes of deleteBackupTracker
func (*FakeBackupControl) TruncateLogBackup ¶ added in v1.4.4
func (fbc *FakeBackupControl) TruncateLogBackup(backup *v1alpha1.Backup, truncateTSO uint64) error
TruncateLogBackup truncate the log backup
type FakeBackupScheduleStatusUpdater ¶ added in v1.1.0
type FakeBackupScheduleStatusUpdater struct { BsLister listers.BackupScheduleLister BsIndexer cache.Indexer // contains filtered or unexported fields }
FakeBackupScheduleStatusUpdater is a fake BackupScheduleStatusUpdaterInterface
func NewFakeBackupScheduleStatusUpdater ¶ added in v1.1.0
func NewFakeBackupScheduleStatusUpdater(bsInformer informers.BackupScheduleInformer) *FakeBackupScheduleStatusUpdater
NewFakeBackupScheduleStatusUpdater returns a FakeBackupScheduleStatusUpdater
func (*FakeBackupScheduleStatusUpdater) SetUpdateBackupScheduleError ¶ added in v1.1.0
func (u *FakeBackupScheduleStatusUpdater) SetUpdateBackupScheduleError(err error, after int)
SetUpdateBackupError sets the error attributes of updateBackupScheduleTracker
func (*FakeBackupScheduleStatusUpdater) UpdateBackupScheduleStatus ¶ added in v1.1.0
func (u *FakeBackupScheduleStatusUpdater) UpdateBackupScheduleStatus(bs *v1alpha1.BackupSchedule, _ *v1alpha1.BackupScheduleStatus, _ *v1alpha1.BackupScheduleStatus) error
UpdateBackupSchedule updates the BackupSchedule
type FakeConfigMapControl ¶ added in v1.1.0
type FakeConfigMapControl struct { CmIndexer cache.Indexer // contains filtered or unexported fields }
FakeConfigMapControl is a fake ConfigMapControlInterface
func NewFakeConfigMapControl ¶ added in v1.1.0
func NewFakeConfigMapControl(cmInformer coreinformers.ConfigMapInformer) *FakeConfigMapControl
NewFakeConfigMapControl returns a FakeConfigMapControl
func (*FakeConfigMapControl) CreateConfigMap ¶ added in v1.1.0
func (c *FakeConfigMapControl) CreateConfigMap(_ runtime.Object, cm *corev1.ConfigMap) (*corev1.ConfigMap, error)
CreateConfigMap adds the ConfigMap to ConfigMapIndexer
func (*FakeConfigMapControl) DeleteConfigMap ¶ added in v1.1.0
DeleteConfigMap deletes the ConfigMap of CmIndexer
func (*FakeConfigMapControl) GetConfigMap ¶ added in v1.1.1
func (*FakeConfigMapControl) SetCreateConfigMapError ¶ added in v1.1.0
func (c *FakeConfigMapControl) SetCreateConfigMapError(err error, after int)
SetCreateConfigMapError sets the error attributes of createConfigMapTracker
func (*FakeConfigMapControl) SetDeleteConfigMapError ¶ added in v1.1.0
func (c *FakeConfigMapControl) SetDeleteConfigMapError(err error, after int)
SetDeleteConfigMapError sets the error attributes of deleteConfigMapTracker
func (*FakeConfigMapControl) SetUpdateConfigMapError ¶ added in v1.1.0
func (c *FakeConfigMapControl) SetUpdateConfigMapError(err error, after int)
SetUpdateConfigMapError sets the error attributes of updateConfigMapTracker
func (*FakeConfigMapControl) UpdateConfigMap ¶ added in v1.1.0
func (c *FakeConfigMapControl) UpdateConfigMap(_ runtime.Object, cm *corev1.ConfigMap) (*corev1.ConfigMap, error)
UpdateConfigMap updates the ConfigMap of CmIndexer
type FakeDMClusterControl ¶ added in v1.2.0
type FakeDMClusterControl struct { DcLister listers.DMClusterLister DcIndexer cache.Indexer // contains filtered or unexported fields }
FakeDMClusterControl is a fake DMClusterControlInterface
func NewFakeDMClusterControl ¶ added in v1.2.0
func NewFakeDMClusterControl(dcInformer tcinformers.DMClusterInformer) *FakeDMClusterControl
NewFakeDMClusterControl returns a FakeDMClusterControl
func (*FakeDMClusterControl) SetUpdateDMClusterError ¶ added in v1.2.0
func (c *FakeDMClusterControl) SetUpdateDMClusterError(err error, after int)
SetUpdateDMClusterError sets the error attributes of updateDMClusterTracker
func (*FakeDMClusterControl) UpdateDMCluster ¶ added in v1.2.0
func (c *FakeDMClusterControl) UpdateDMCluster(dc *v1alpha1.DMCluster, _ *v1alpha1.DMClusterStatus, _ *v1alpha1.DMClusterStatus) (*v1alpha1.DMCluster, error)
UpdateDMCluster updates the DMCluster
type FakeGeneralPVCControl ¶ added in v1.1.0
type FakeGeneralPVCControl struct { PVCLister corelisters.PersistentVolumeClaimLister PVCIndexer cache.Indexer // contains filtered or unexported fields }
FakeGeneralPVCControl is a fake GeneralPVCControlInterface
func NewFakeGeneralPVCControl ¶ added in v1.1.0
func NewFakeGeneralPVCControl(pvcInformer coreinformers.PersistentVolumeClaimInformer) *FakeGeneralPVCControl
NewFakeGeneralPVCControl returns a FakeGeneralPVCControl
func (*FakeGeneralPVCControl) CreatePVC ¶ added in v1.1.0
func (c *FakeGeneralPVCControl) CreatePVC(_ runtime.Object, pvc *corev1.PersistentVolumeClaim) error
CreatePVC adds the pvc to PVCIndexer
func (*FakeGeneralPVCControl) SetCreatePVCError ¶ added in v1.1.0
func (c *FakeGeneralPVCControl) SetCreatePVCError(err error, after int)
SetCreatePVCError sets the error attributes of createPVCTracker
type FakeGenericControl ¶ added in v1.1.0
FakeGenericControl is a fake GenericControlInterface
func NewFakeGenericControl ¶ added in v1.1.0
func NewFakeGenericControl(initObjects ...runtime.Object) *FakeGenericControl
NewFakeGenericControl returns a FakeGenericControl
func (*FakeGenericControl) AddObject ¶ added in v1.1.0
func (c *FakeGenericControl) AddObject(object client.Object) error
AddObject is used to prepare the indexer for fakeGenericControl
func (*FakeGenericControl) Create ¶ added in v1.1.0
func (c *FakeGenericControl) Create(controller, obj client.Object, setOwnerFlag bool) error
func (*FakeGenericControl) CreateOrUpdate ¶ added in v1.1.0
func (*FakeGenericControl) Delete ¶ added in v1.1.0
func (c *FakeGenericControl) Delete(controller, obj client.Object) error
func (*FakeGenericControl) SetCreateError ¶ added in v1.1.0
func (c *FakeGenericControl) SetCreateError(err error, after int)
func (*FakeGenericControl) SetCreateOrUpdateError ¶ added in v1.1.0
func (c *FakeGenericControl) SetCreateOrUpdateError(err error, after int)
func (*FakeGenericControl) SetDeleteError ¶ added in v1.1.0
func (c *FakeGenericControl) SetDeleteError(err error, after int)
func (*FakeGenericControl) SetExistError ¶ added in v1.1.0
func (c *FakeGenericControl) SetExistError(err error, after int)
func (*FakeGenericControl) SetUpdateStatusError ¶ added in v1.1.0
func (c *FakeGenericControl) SetUpdateStatusError(err error, after int)
func (*FakeGenericControl) UpdateStatus ¶ added in v1.1.0
func (c *FakeGenericControl) UpdateStatus(obj client.Object) error
UpdateStatus update the /status subresource of object
type FakeJobControl ¶ added in v1.1.0
type FakeJobControl struct { JobLister batchlisters.JobLister JobIndexer cache.Indexer // contains filtered or unexported fields }
FakeJobControl is a fake JobControlInterface
func NewFakeJobControl ¶ added in v1.1.0
func NewFakeJobControl(jobInformer batchinformers.JobInformer) *FakeJobControl
NewFakeJobControl returns a FakeJobControl
func (*FakeJobControl) SetCreateJobError ¶ added in v1.1.0
func (c *FakeJobControl) SetCreateJobError(err error, after int)
SetCreateJobError sets the error attributes of createJobTracker
func (*FakeJobControl) SetDeleteJobError ¶ added in v1.1.0
func (c *FakeJobControl) SetDeleteJobError(err error, after int)
SetDeleteJobError sets the error attributes of deleteJobTracker
type FakePVCControl ¶
FakePVCControl is a fake PVCControlInterface
func NewFakePVCControl ¶
func NewFakePVCControl(pvcInformer coreinformers.PersistentVolumeClaimInformer) *FakePVCControl
NewFakePVCControl returns a FakePVCControl
func (*FakePVCControl) CreatePVC ¶ added in v1.2.0
func (c *FakePVCControl) CreatePVC(_ runtime.Object, pvc *corev1.PersistentVolumeClaim) error
AddPVC add new pvc
func (*FakePVCControl) DeletePVC ¶
func (c *FakePVCControl) DeletePVC(_ runtime.Object, pvc *corev1.PersistentVolumeClaim) error
DeletePVC deletes the pvc
func (*FakePVCControl) GetPVC ¶ added in v1.1.0
func (c *FakePVCControl) GetPVC(name, namespace string) (*corev1.PersistentVolumeClaim, error)
func (*FakePVCControl) SetDeletePVCError ¶
func (c *FakePVCControl) SetDeletePVCError(err error, after int)
SetDeletePVCError sets the error attributes of deletePVCTracker
func (*FakePVCControl) SetUpdatePVCError ¶
func (c *FakePVCControl) SetUpdatePVCError(err error, after int)
SetUpdatePVCError sets the error attributes of updatePVCTracker
func (*FakePVCControl) UpdateMetaInfo ¶
func (c *FakePVCControl) UpdateMetaInfo(_ runtime.Object, pvc *corev1.PersistentVolumeClaim, pod *corev1.Pod) (*corev1.PersistentVolumeClaim, error)
UpdateMetaInfo updates the meta info of pvc
func (*FakePVCControl) UpdatePVC ¶
func (c *FakePVCControl) UpdatePVC(_ runtime.Object, pvc *corev1.PersistentVolumeClaim) (*corev1.PersistentVolumeClaim, error)
UpdatePVC 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) CreatePV ¶ added in v1.2.0
func (c *FakePVControl) CreatePV(_ runtime.Object, pv *corev1.PersistentVolume) error
CreatePV create new pv
func (*FakePVControl) GetPV ¶ added in v1.2.0
func (c *FakePVControl) GetPV(name string) (*corev1.PersistentVolume, error)
func (*FakePVControl) PatchPVClaimRef ¶ added in v1.2.0
func (c *FakePVControl) PatchPVClaimRef(obj runtime.Object, pv *corev1.PersistentVolume, pvcName string) error
func (*FakePVControl) PatchPVReclaimPolicy ¶
func (c *FakePVControl) PatchPVReclaimPolicy(_ runtime.Object, pv *corev1.PersistentVolume, reclaimPolicy corev1.PersistentVolumeReclaimPolicy) error
PatchPVReclaimPolicy patchs the reclaim policy of PV
func (*FakePVControl) SetUpdatePVError ¶
func (c *FakePVControl) SetUpdatePVError(err error, after int)
SetUpdatePVError sets the error attributes of updatePVTracker
func (*FakePVControl) UpdateMetaInfo ¶
func (c *FakePVControl) UpdateMetaInfo(obj runtime.Object, 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) ForceDeletePod ¶ added in v1.4.0
func (*FakePodControl) SetDeletePodError ¶ added in v0.2.0
func (c *FakePodControl) SetDeletePodError(err error, after int)
SetDeletePodError sets the error attributes of deletePodTracker
func (*FakePodControl) SetGetClusterError ¶
func (c *FakePodControl) SetGetClusterError(err error, after int)
SetGetClusterError sets the error attributes of getClusterTracker
func (*FakePodControl) SetGetMemberError ¶
func (c *FakePodControl) SetGetMemberError(err error, after int)
SetGetMemberError sets the error attributes of getMemberTracker
func (*FakePodControl) SetGetStoreError ¶
func (c *FakePodControl) SetGetStoreError(err error, after int)
SetGetStoreError sets the error attributes of getStoreTracker
func (*FakePodControl) SetUpdatePodError ¶
func (c *FakePodControl) SetUpdatePodError(err error, after int)
SetUpdatePodError sets the error attributes of updatePodTracker
func (*FakePodControl) UpdateMetaInfo ¶
func (c *FakePodControl) UpdateMetaInfo(_ *v1alpha1.TidbCluster, pod *corev1.Pod) (*corev1.Pod, error)
UpdateMetaInfo update the meta info of Pod
type FakeRestoreConditionUpdater ¶ added in v1.1.0
type FakeRestoreConditionUpdater struct { RestoreLister listers.RestoreLister RestoreIndexer cache.Indexer // contains filtered or unexported fields }
FakeRestoreConditionUpdater is a fake RestoreConditionUpdaterInterface
func NewFakeRestoreConditionUpdater ¶ added in v1.1.0
func NewFakeRestoreConditionUpdater(restoreInformer informers.RestoreInformer) *FakeRestoreConditionUpdater
NewFakeRestoreConditionUpdater returns a FakeRestoreConditionUpdater
func (*FakeRestoreConditionUpdater) SetUpdateRestoreError ¶ added in v1.1.0
func (u *FakeRestoreConditionUpdater) SetUpdateRestoreError(err error, after int)
SetUpdateRestoreError sets the error attributes of updateRestoreTracker
func (*FakeRestoreConditionUpdater) Update ¶ added in v1.1.0
func (u *FakeRestoreConditionUpdater) Update(restore *v1alpha1.Restore, _ *v1alpha1.RestoreCondition, _ *RestoreUpdateStatus) error
UpdateRestore updates the Restore
type FakeRestoreControl ¶ added in v1.4.0
type FakeRestoreControl struct { RestoreLister listers.RestoreLister RestoreIndexer cache.Indexer // contains filtered or unexported fields }
FakeRestoreControl is a fake RestoreControlInterface
func NewFakeRestoreControl ¶ added in v1.4.0
func NewFakeRestoreControl(rsInformer tcinformers.RestoreInformer) *FakeRestoreControl
NewFakeRestoreControl returns a FakeRestoreControl
func (*FakeRestoreControl) UpdateRestore ¶ added in v1.4.0
UpdateRestore updates the Restore
type FakeSecretControl ¶ added in v1.1.0
type FakeSecretControl struct { SecretLister corelisterv1.SecretLister SecretIndexer cache.Indexer // contains filtered or unexported fields }
FakeSecretControl is a fake SecretControlInterface
func NewFakeSecretControl ¶ added in v1.1.0
func NewFakeSecretControl(secretInformer coreinformers.SecretInformer) *FakeSecretControl
NewFakeSecretControl returns a FakeSecretControl
func (*FakeSecretControl) Check ¶ added in v1.1.0
func (c *FakeSecretControl) Check(ns string, secretName string) bool
type FakeServiceControl ¶
type FakeServiceControl struct { SvcLister corelisters.ServiceLister SvcIndexer cache.Indexer EpsIndexer cache.Indexer // contains filtered or unexported fields }
FakeServiceControl is a fake ServiceControlInterface
func NewFakeServiceControl ¶
func NewFakeServiceControl(svcInformer coreinformers.ServiceInformer, epsInformer coreinformers.EndpointsInformer) *FakeServiceControl
NewFakeServiceControl returns a FakeServiceControl
func (*FakeServiceControl) CreateService ¶
CreateService adds the service to SvcIndexer
func (*FakeServiceControl) DeleteService ¶
DeleteService deletes the service of SvcIndexer
func (*FakeServiceControl) SetCreateServiceError ¶
func (c *FakeServiceControl) SetCreateServiceError(err error, after int)
SetCreateServiceError sets the error attributes of createServiceTracker
func (*FakeServiceControl) SetDeleteServiceError ¶
func (c *FakeServiceControl) SetDeleteServiceError(err error, after int)
SetDeleteServiceError sets the error attributes of deleteServiceTracker
func (*FakeServiceControl) SetUpdateServiceError ¶
func (c *FakeServiceControl) SetUpdateServiceError(err error, after int)
SetUpdateServiceError sets the error attributes of updateServiceTracker
func (*FakeServiceControl) UpdateService ¶
func (c *FakeServiceControl) UpdateService(_ runtime.Object, svc *corev1.Service) (*corev1.Service, error)
UpdateService updates the service of SvcIndexer
type FakeStatefulSetControl ¶
type FakeStatefulSetControl struct { SetLister appslisters.StatefulSetLister SetIndexer cache.Indexer // contains filtered or unexported fields }
FakeStatefulSetControl is a fake StatefulSetControlInterface
func NewFakeStatefulSetControl ¶
func NewFakeStatefulSetControl(setInformer appsinformers.StatefulSetInformer) *FakeStatefulSetControl
NewFakeStatefulSetControl returns a FakeStatefulSetControl
func (*FakeStatefulSetControl) CreateStatefulSet ¶
func (c *FakeStatefulSetControl) CreateStatefulSet(controller runtime.Object, set *apps.StatefulSet) error
CreateStatefulSet adds the statefulset to SetIndexer
func (*FakeStatefulSetControl) DeleteStatefulSet ¶
func (c *FakeStatefulSetControl) DeleteStatefulSet(_ runtime.Object, _ *apps.StatefulSet) error
DeleteStatefulSet deletes the statefulset of SetIndexer
func (*FakeStatefulSetControl) SetCreateStatefulSetError ¶
func (c *FakeStatefulSetControl) SetCreateStatefulSetError(err error, after int)
SetCreateStatefulSetError sets the error attributes of createStatefulSetTracker
func (*FakeStatefulSetControl) SetDeleteStatefulSetError ¶
func (c *FakeStatefulSetControl) SetDeleteStatefulSetError(err error, after int)
SetDeleteStatefulSetError sets the error attributes of deleteStatefulSetTracker
func (*FakeStatefulSetControl) SetStatusChange ¶
func (c *FakeStatefulSetControl) SetStatusChange(fn func(*apps.StatefulSet))
func (*FakeStatefulSetControl) SetUpdateStatefulSetError ¶
func (c *FakeStatefulSetControl) SetUpdateStatefulSetError(err error, after int)
SetUpdateStatefulSetError sets the error attributes of updateStatefulSetTracker
func (*FakeStatefulSetControl) UpdateStatefulSet ¶
func (c *FakeStatefulSetControl) UpdateStatefulSet(_ runtime.Object, set *apps.StatefulSet) (*apps.StatefulSet, error)
UpdateStatefulSet updates the statefulset of SetIndexer
type FakeTiCDCControl ¶ added in v1.1.0
type FakeTiCDCControl struct { GetStatusFn func(tc *v1alpha1.TidbCluster, ordinal int32) (*CaptureStatus, error) DrainCaptureFn func(tc *v1alpha1.TidbCluster, ordinal int32) (tableCount int, retry bool, err error) ResignOwnerFn func(tc *v1alpha1.TidbCluster, ordinal int32) (ok bool, err error) IsHealthyFn func(tc *v1alpha1.TidbCluster, ordinal int32) (ok bool, err error) }
FakeTiCDCControl is a fake implementation of TiCDCControlInterface.
func NewFakeTiCDCControl ¶ added in v1.1.0
func NewFakeTiCDCControl() *FakeTiCDCControl
NewFakeTiCDCControl returns a FakeTiCDCControl instance
func (*FakeTiCDCControl) DrainCapture ¶ added in v1.3.8
func (c *FakeTiCDCControl) DrainCapture(tc *v1alpha1.TidbCluster, ordinal int32) (tableCount int, retry bool, err error)
func (*FakeTiCDCControl) GetStatus ¶ added in v1.2.5
func (c *FakeTiCDCControl) GetStatus(tc *v1alpha1.TidbCluster, ordinal int32) (*CaptureStatus, error)
func (*FakeTiCDCControl) IsHealthy ¶ added in v1.3.8
func (c *FakeTiCDCControl) IsHealthy(tc *v1alpha1.TidbCluster, ordinal int32) (bool, error)
func (*FakeTiCDCControl) ResignOwner ¶ added in v1.3.8
func (c *FakeTiCDCControl) ResignOwner(tc *v1alpha1.TidbCluster, ordinal int32) (ok bool, err error)
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(secretLister corelisterv1.SecretLister) *FakeTiDBControl
NewFakeTiDBControl returns a FakeTiDBControl instance
func (*FakeTiDBControl) GetHealth ¶ added in v0.2.0
func (c *FakeTiDBControl) GetHealth(tc *v1alpha1.TidbCluster, ordinal int32) (bool, error)
func (*FakeTiDBControl) GetInfo ¶ added in v1.0.0
func (c *FakeTiDBControl) GetInfo(tc *v1alpha1.TidbCluster, ordinal int32) (*DBInfo, error)
func (*FakeTiDBControl) SetHealth ¶ added in v0.2.0
func (c *FakeTiDBControl) SetHealth(healthInfo map[string]bool)
SetHealth set health info for FakeTiDBControl
func (*FakeTiDBControl) SetLabelsErr ¶ added in v1.4.0
func (c *FakeTiDBControl) SetLabelsErr(err error)
func (*FakeTiDBControl) SetServerLabels ¶ added in v1.4.0
func (c *FakeTiDBControl) SetServerLabels(tc *v1alpha1.TidbCluster, ordinal int32, labels map[string]string) error
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) Create ¶ added in v1.2.0
func (c *FakeTidbClusterControl) Create(tc *v1alpha1.TidbCluster) error
func (*FakeTidbClusterControl) Patch ¶ added in v1.2.0
func (c *FakeTidbClusterControl) Patch(tc *v1alpha1.TidbCluster, data []byte, subresources ...string) (result *v1alpha1.TidbCluster, err error)
func (*FakeTidbClusterControl) SetUpdateTidbClusterError ¶ added in v0.2.0
func (c *FakeTidbClusterControl) SetUpdateTidbClusterError(err error, after int)
SetUpdateTidbClusterError sets the error attributes of updateTidbClusterTracker
func (*FakeTidbClusterControl) Update ¶ added in v1.4.0
func (c *FakeTidbClusterControl) Update(tc *v1alpha1.TidbCluster) (*v1alpha1.TidbCluster, error)
Update updates the TidbCluster different from the logic before
func (*FakeTidbClusterControl) UpdateTidbCluster ¶ added in v0.2.0
func (c *FakeTidbClusterControl) UpdateTidbCluster(tc *v1alpha1.TidbCluster, _ *v1alpha1.TidbClusterStatus, _ *v1alpha1.TidbClusterStatus) (*v1alpha1.TidbCluster, error)
UpdateTidbCluster updates the TidbCluster
type GeneralPVCControlInterface ¶ added in v1.1.0
type GeneralPVCControlInterface interface {
CreatePVC(object runtime.Object, pvc *corev1.PersistentVolumeClaim) error
}
GeneralPVCControlInterface manages PVCs used in backup and restore's pvc
func NewRealGeneralPVCControl ¶ added in v1.1.0
func NewRealGeneralPVCControl( kubeCli kubernetes.Interface, recorder record.EventRecorder, ) GeneralPVCControlInterface
NewRealGeneralPVCControl creates a new GeneralPVCControlInterface
type GenericControlInterface ¶ added in v1.1.0
type GenericControlInterface interface { CreateOrUpdate(controller, obj client.Object, mergeFn MergeFn, setOwnerFlag bool) (runtime.Object, error) Create(controller, obj client.Object, setOwnerFlag bool) error UpdateStatus(obj client.Object) error Exist(key client.ObjectKey, obj client.Object) (bool, error) Delete(controller, obj client.Object) error }
GenericControlInterface manages generic object that managed by an arbitrary controller
func NewRealGenericControl ¶ added in v1.1.0
func NewRealGenericControl(client client.Client, recorder record.EventRecorder) GenericControlInterface
type GetControllerFn ¶ added in v1.1.0
type IgnoreError ¶ added in v1.1.0
type IgnoreError struct {
// contains filtered or unexported fields
}
IgnoreError is used to ignore this item, this error type shouldn't be considered as a real error, no need to requeue
func (*IgnoreError) Error ¶ added in v1.1.0
func (re *IgnoreError) Error() string
type JobControlInterface ¶ added in v1.1.0
type JobControlInterface interface { CreateJob(object runtime.Object, job *batchv1.Job) error DeleteJob(object runtime.Object, job *batchv1.Job) error }
JobControlInterface manages Jobs used in backup、restore and clean
func NewRealJobControl ¶ added in v1.1.0
func NewRealJobControl( kubeCli kubernetes.Interface, recorder record.EventRecorder, ) JobControlInterface
NewRealJobControl creates a new JobControlInterface
type MergeFn ¶ added in v1.1.0
MergeFn knows how to merge a desired object into the current object. Typically, merge should only set the specific fields the caller wants to control to the existing object instead of override a whole struct. e.g.
Prefer:
existing.spec.type = desired.spec.type existing.spec.externalTrafficPolicy = desired.spec.externalTrafficPolicy
Instead of:
existing.spec = desired.spec
However, this could be tedious for large object if the caller want to control lots of the fields, if there is no one else will mutate this object or cooperation is not needed, it is okay to do aggressive override. Note that aggressive override usually causes unnecessary updates because the object will be mutated after POST/PUT to api-server (e.g. Defaulting), an annotation based technique could be used to avoid such updating: set a last-applied-config annotation and diff the annotation instead of the real spec.
type PVCControlInterface ¶
type PVCControlInterface interface { UpdateMetaInfo(runtime.Object, *corev1.PersistentVolumeClaim, *corev1.Pod) (*corev1.PersistentVolumeClaim, error) UpdatePVC(runtime.Object, *corev1.PersistentVolumeClaim) (*corev1.PersistentVolumeClaim, error) DeletePVC(runtime.Object, *corev1.PersistentVolumeClaim) error GetPVC(name, namespace string) (*corev1.PersistentVolumeClaim, error) CreatePVC(controller runtime.Object, pvc *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(runtime.Object, *corev1.PersistentVolume, corev1.PersistentVolumeReclaimPolicy) error UpdateMetaInfo(runtime.Object, *corev1.PersistentVolume) (*corev1.PersistentVolume, error) PatchPVClaimRef(runtime.Object, *corev1.PersistentVolume, string) error CreatePV(obj runtime.Object, pv *corev1.PersistentVolume) error GetPV(name string) (*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(runtime.Object, *corev1.Pod) error ForceDeletePod(runtime.Object, *corev1.Pod) error UpdatePod(runtime.Object, *corev1.Pod) (*corev1.Pod, error) }
PodControlInterface manages Pods used in TidbCluster
func NewRealPodControl ¶
func NewRealPodControl( kubeCli kubernetes.Interface, pdControl pdapi.PDControlInterface, podLister corelisters.PodLister, recorder record.EventRecorder, ) PodControlInterface
NewRealPodControl creates a new PodControlInterface
type RequestTracker ¶ added in v1.1.0
type RequestTracker struct {
// contains filtered or unexported fields
}
RequestTracker is used by unit test for mocking request error
func (*RequestTracker) ErrorReady ¶ added in v1.1.0
func (rt *RequestTracker) ErrorReady() bool
func (*RequestTracker) GetError ¶ added in v1.1.0
func (rt *RequestTracker) GetError() error
func (*RequestTracker) GetRequests ¶ added in v1.1.0
func (rt *RequestTracker) GetRequests() int
func (*RequestTracker) Inc ¶ added in v1.1.0
func (rt *RequestTracker) Inc()
func (*RequestTracker) Reset ¶ added in v1.1.0
func (rt *RequestTracker) Reset()
func (*RequestTracker) SetAfter ¶ added in v1.1.0
func (rt *RequestTracker) SetAfter(after int) *RequestTracker
func (*RequestTracker) SetError ¶ added in v1.1.0
func (rt *RequestTracker) SetError(err error) *RequestTracker
func (*RequestTracker) SetRequests ¶ added in v1.1.0
func (rt *RequestTracker) SetRequests(requests int) *RequestTracker
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 RestoreConditionUpdaterInterface ¶ added in v1.1.0
type RestoreConditionUpdaterInterface interface {
Update(restore *v1alpha1.Restore, condition *v1alpha1.RestoreCondition, newStatus *RestoreUpdateStatus) error
}
RestoreConditionUpdaterInterface enables updating Restore conditions.
func NewRealRestoreConditionUpdater ¶ added in v1.1.0
func NewRealRestoreConditionUpdater( cli versioned.Interface, restoreLister listers.RestoreLister, recorder record.EventRecorder) RestoreConditionUpdaterInterface
returns a RestoreConditionUpdaterInterface that updates the Status of a Restore,
type RestoreControlInterface ¶ added in v1.4.0
type RestoreControlInterface interface {
UpdateRestore(*v1alpha1.Restore) (*v1alpha1.Restore, error)
}
RestoreControlInterface manages Restores
func NewRealRestoreControl ¶ added in v1.4.0
func NewRealRestoreControl( cli versioned.Interface, rsLister listers.RestoreLister, recorder record.EventRecorder, ) RestoreControlInterface
NewRealRestoreControl creates a new RestoreControlInterface
type RestoreUpdateStatus ¶ added in v1.1.10
type RestoreUpdateStatus struct { // TimeStarted is the time at which the restore was started. TimeStarted *metav1.Time // TimeCompleted is the time at which the restore was completed. TimeCompleted *metav1.Time // CommitTs is the snapshot time point of tidb cluster. CommitTs *string // ProgressStep the step name of progress. ProgressStep *string // Progress is the step's progress value. Progress *float64 // ProgressUpdateTime is the progress update time. ProgressUpdateTime *metav1.Time }
RestoreUpdateStatus represents the status of a restore to be updated. This structure should keep synced with the fields in `RestoreStatus` except for `Phase` and `Conditions`.
type SecretControlInterface ¶ added in v1.1.0
type SecretControlInterface interface { Load(ns string, secretName string) ([]byte, []byte, error) Check(ns string, secretName string) bool Create(ns string, secret *v1.Secret) error }
SecretControlInterface manages certificates used by TiDB clusters
func NewRealSecretControl ¶ added in v1.1.0
func NewRealSecretControl( kubeCli kubernetes.Interface, secretLister corelisterv1.SecretLister, recorder record.EventRecorder, ) SecretControlInterface
NewRealSecretControl creates a new SecretControlInterface
type ServiceControlInterface ¶
type ServiceControlInterface interface { CreateService(runtime.Object, *corev1.Service) error UpdateService(runtime.Object, *corev1.Service) (*corev1.Service, error) DeleteService(runtime.Object, *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(runtime.Object, *apps.StatefulSet) error UpdateStatefulSet(runtime.Object, *apps.StatefulSet) (*apps.StatefulSet, error) DeleteStatefulSet(runtime.Object, *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 TiCDCControlInterface ¶ added in v1.1.0
type TiCDCControlInterface interface { // GetStatus returns ticdc's status GetStatus(tc *v1alpha1.TidbCluster, ordinal int32) (*CaptureStatus, error) // DrainCapture remove capture ownership and moves its tables to other captures. // Returns the number of tables in the capture. // If there is only one capture, it always return 0. DrainCapture(tc *v1alpha1.TidbCluster, ordinal int32) (tableCount int, retry bool, err error) // ResignOwner tries to resign ownership from the current capture. // Returns true if the capture has already resigned ownership, // otherwise caller should retry resign owner. // If there is only one capture, it always return true. ResignOwner(tc *v1alpha1.TidbCluster, ordinal int32) (ok bool, err error) // IsHealthy gets the healthy status of TiCDC cluster. // Returns true if the TiCDC cluster is heathy. IsHealthy(tc *v1alpha1.TidbCluster, ordinal int32) (ok bool, err error) }
TiCDCControlInterface is the interface that knows how to manage ticdc captures
type TiDBControlInterface ¶ added in v0.2.0
type TiDBControlInterface interface { // GetHealth returns tidb's health info GetHealth(tc *v1alpha1.TidbCluster, ordinal int32) (bool, error) // Get TIDB info return tidb's DBInfo GetInfo(tc *v1alpha1.TidbCluster, ordinal int32) (*DBInfo, error) // SetServerLabels update TiDB's labels config SetServerLabels(tc *v1alpha1.TidbCluster, ordinal int32, labels map[string]string) error }
TiDBControlInterface is the interface that knows how to manage tidb peers
type TiProxyControlInterface ¶ added in v1.4.0
type TiProxyControlInterface interface { // SetConfigProxy set the proxy part in config SetConfigProxy(tc *v1alpha1.TidbCluster, ordinal int32, cfg *config.ProxyServerOnline) error // GetConfigProxy get the proxy part in config GetConfigProxy(tc *v1alpha1.TidbCluster, ordinal int32) (*config.ProxyServerOnline, error) }
TiProxyControlInterface is the interface that knows how to control tiproxy clusters
type TidbClusterControlInterface ¶ added in v0.2.0
type TidbClusterControlInterface interface { UpdateTidbCluster(*v1alpha1.TidbCluster, *v1alpha1.TidbClusterStatus, *v1alpha1.TidbClusterStatus) (*v1alpha1.TidbCluster, error) Update(*v1alpha1.TidbCluster) (*v1alpha1.TidbCluster, error) Create(*v1alpha1.TidbCluster) error Patch(tc *v1alpha1.TidbCluster, data []byte, subresources ...string) (result *v1alpha1.TidbCluster, err 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
type TypedControlInterface ¶ added in v1.1.0
type TypedControlInterface interface { // CreateOrUpdateSecret create the desired secret or update the current one to desired state if already existed CreateOrUpdateSecret(controller client.Object, secret *corev1.Secret) (*corev1.Secret, error) // CreateOrUpdateConfigMap create client desired configmap or update the current one to desired state if already existed CreateOrUpdateConfigMap(controller client.Object, cm *corev1.ConfigMap) (*corev1.ConfigMap, error) // CreateOrUpdateClusterRole the desired clusterRole or update the current one to desired state if already existed CreateOrUpdateClusterRole(controller client.Object, clusterRole *rbacv1.ClusterRole) (*rbacv1.ClusterRole, error) // CreateOrUpdateClusterRoleBinding create the desired clusterRoleBinding or update the current one to desired state if already existed CreateOrUpdateClusterRoleBinding(controller client.Object, crb *rbacv1.ClusterRoleBinding) (*rbacv1.ClusterRoleBinding, error) // CreateOrUpdateRole create the desired role or update the current one to desired state if already existed CreateOrUpdateRole(controller client.Object, role *rbacv1.Role) (*rbacv1.Role, error) // CreateOrUpdateRoleBinding create the desired rolebinding or update the current one to desired state if already existed CreateOrUpdateRoleBinding(controller client.Object, cr *rbacv1.RoleBinding) (*rbacv1.RoleBinding, error) // CreateOrUpdateServiceAccount create the desired serviceaccount or update the current one to desired state if already existed CreateOrUpdateServiceAccount(controller client.Object, sa *corev1.ServiceAccount) (*corev1.ServiceAccount, error) // CreateOrUpdateService create the desired service or update the current one to desired state if already existed CreateOrUpdateService(controller client.Object, svc *corev1.Service) (*corev1.Service, error) // CreateOrUpdateDeployment create the desired deployment or update the current one to desired state if already existed CreateOrUpdateDeployment(controller client.Object, deploy *appsv1.Deployment) (*appsv1.Deployment, error) // CreateOrUpdatePVC create the desired pvc or update the current one to desired state if already existed CreateOrUpdatePVC(controller client.Object, pvc *corev1.PersistentVolumeClaim, setOwnerFlag bool) (*corev1.PersistentVolumeClaim, error) // CreateOrUpdateIngress create the desired ingress or update the current one to desired state if already existed CreateOrUpdateIngress(controller client.Object, ingress *networkingv1.Ingress) (*networkingv1.Ingress, error) // CreateOrUpdateIngressV1beta1 create the desired v1beta1 ingress or update the current one to desired state if already existed CreateOrUpdateIngressV1beta1(controller client.Object, ingress *extensionsv1beta1.Ingress) (*extensionsv1beta1.Ingress, error) // UpdateStatus update the /status subresource of the object UpdateStatus(newStatus client.Object) error // Delete delete the given object from the cluster Delete(controller, obj client.Object) error // Create create the given object for the controller Create(controller, obj client.Object) error // Exist check whether object exists Exist(key client.ObjectKey, obj client.Object) (bool, error) }
GenericControlInterface is a wrapper to manage typed object that managed by an arbitrary controller
func NewTypedControl ¶ added in v1.1.0
func NewTypedControl(control GenericControlInterface) TypedControlInterface
NewTypedControl wraps a GenericControlInterface to a TypedControlInterface
Source Files ¶
- backup_control.go
- backup_schedule_status_updater.go
- backup_status_updater.go
- configmap_control.go
- controller_utils.go
- dependences.go
- dmcluster_control.go
- dmmaster_control.go
- equality.go
- general_pvc_control.go
- generic_control.go
- http_client.go
- job_control.go
- pd_control.go
- pod_control.go
- pv_control.go
- pvc_control.go
- rate_limiter.go
- restore_control.go
- restore_status_updater.go
- secret_control.go
- service_control.go
- stateful_set_control.go
- ticdc_control.go
- tidb_control.go
- tidbcluster_control.go
- tikv_control.go
- tiproxy_control.go