Documentation ¶
Index ¶
- Constants
- Variables
- func AnnAdditionalProm(name string, port int32) map[string]string
- func AnnProm(port int32) map[string]string
- func ContainerResource(req corev1.ResourceRequirements) corev1.ResourceRequirements
- func DeploymentPodSpecChanged(newDep *appsv1.Deployment, oldDep *appsv1.Deployment) bool
- func DiscoveryMemberName(clusterName string) string
- func EmptyClone(obj runtime.Object) (runtime.Object, error)
- func GetDeploymentLastAppliedPodTemplate(dep *appsv1.Deployment) (*corev1.PodSpec, error)
- func GetOwnerRef(tc *v1alpha1.TikvCluster) metav1.OwnerReference
- func GetPDClient(pdControl pdapi.PDControlInterface, tc *v1alpha1.TikvCluster) pdapi.PDClient
- func GuaranteedUpdate(cli client.Client, obj runtime.Object, updateFunc func() error) error
- func IgnoreErrorf(format string, a ...interface{}) error
- func InferObjectKind(obj runtime.Object) (schema.GroupVersionKind, error)
- func IngressEqual(newIngress, oldIngres *extensionsv1beta1.Ingress) (bool, error)
- func Int32Ptr(i int32) *int32
- func IsIgnoreError(err error) bool
- func IsRequeueError(err error) bool
- func MemberConfigMapName(tc *v1alpha1.TikvCluster, member v1alpha1.MemberType) string
- func NewFakePDClient(pdControl *pdapi.FakePDControl, tc *v1alpha1.TikvCluster) *pdapi.FakePDClient
- func PDMemberName(clusterName 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 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 WatchForController(informer cache.SharedIndexInformer, q workqueue.Interface, fn GetControllerFn, ...)
- func WatchForObject(informer cache.SharedIndexInformer, q workqueue.Interface)
- type ConfigMapControlInterface
- type FakeConfigMapControl
- func (cc *FakeConfigMapControl) CreateConfigMap(_ runtime.Object, cm *corev1.ConfigMap) (*corev1.ConfigMap, error)
- func (cc *FakeConfigMapControl) DeleteConfigMap(_ runtime.Object, _ *corev1.ConfigMap) error
- func (cc *FakeConfigMapControl) GetConfigMap(controller runtime.Object, cm *corev1.ConfigMap) (*corev1.ConfigMap, error)
- func (cc *FakeConfigMapControl) SetCreateConfigMapError(err error, after int)
- func (cc *FakeConfigMapControl) SetDeleteConfigMapError(err error, after int)
- func (cc *FakeConfigMapControl) SetUpdateConfigMapError(err error, after int)
- func (cc *FakeConfigMapControl) UpdateConfigMap(_ runtime.Object, cm *corev1.ConfigMap) (*corev1.ConfigMap, error)
- type FakeGeneralPVCControl
- type FakeGenericControl
- func (gc *FakeGenericControl) AddObject(object runtime.Object) error
- func (gc *FakeGenericControl) Create(controller, obj runtime.Object, setOwnerFlag bool) error
- func (gc *FakeGenericControl) CreateOrUpdate(controller, obj runtime.Object, fn MergeFn, setOwnerFlag bool) (runtime.Object, error)
- func (gc *FakeGenericControl) Delete(controller, obj runtime.Object) error
- func (gc *FakeGenericControl) Exist(key client.ObjectKey, obj runtime.Object) (bool, error)
- func (gc *FakeGenericControl) SetCreateError(err error, after int)
- func (gc *FakeGenericControl) SetCreateOrUpdateError(err error, after int)
- func (gc *FakeGenericControl) SetDeleteError(err error, after int)
- func (gc *FakeGenericControl) SetExistError(err error, after int)
- func (gc *FakeGenericControl) SetUpdateStatusError(err error, after int)
- func (gc *FakeGenericControl) UpdateStatus(obj runtime.Object) error
- type FakePVCControl
- func (fpc *FakePVCControl) DeletePVC(_ *v1alpha1.TikvCluster, pvc *corev1.PersistentVolumeClaim) error
- func (fpc *FakePVCControl) GetPVC(name, namespace string) (*corev1.PersistentVolumeClaim, error)
- func (fpc *FakePVCControl) SetDeletePVCError(err error, after int)
- func (fpc *FakePVCControl) SetUpdatePVCError(err error, after int)
- func (fpc *FakePVCControl) UpdateMetaInfo(_ *v1alpha1.TikvCluster, pvc *corev1.PersistentVolumeClaim, pod *corev1.Pod) (*corev1.PersistentVolumeClaim, error)
- func (fpc *FakePVCControl) UpdatePVC(_ *v1alpha1.TikvCluster, pvc *corev1.PersistentVolumeClaim) (*corev1.PersistentVolumeClaim, error)
- type FakePVControl
- type FakePodControl
- func (fpc *FakePodControl) DeletePod(_ *v1alpha1.TikvCluster, 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.TikvCluster, pod *corev1.Pod) (*corev1.Pod, error)
- func (fpc *FakePodControl) UpdatePod(_ *v1alpha1.TikvCluster, pod *corev1.Pod) (*corev1.Pod, error)
- type FakeSecretControl
- type FakeServiceControl
- func (ssc *FakeServiceControl) CreateService(_ *v1alpha1.TikvCluster, svc *corev1.Service) error
- func (ssc *FakeServiceControl) DeleteService(_ *v1alpha1.TikvCluster, _ *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.TikvCluster, svc *corev1.Service) (*corev1.Service, error)
- type FakeStatefulSetControl
- func (ssc *FakeStatefulSetControl) CreateStatefulSet(_ *v1alpha1.TikvCluster, set *apps.StatefulSet) error
- func (ssc *FakeStatefulSetControl) DeleteStatefulSet(_ *v1alpha1.TikvCluster, _ *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.TikvCluster, set *apps.StatefulSet) (*apps.StatefulSet, error)
- type FakeTikvClusterControl
- type GeneralPVCControlInterface
- type GenericControlInterface
- type GetControllerFn
- type IgnoreError
- 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 SecretControlInterface
- type ServiceControlInterface
- type StatefulSetControlInterface
- type TikvClusterControlInterface
- type TypedControlInterface
Constants ¶
const ( // LastAppliedPodTemplate is annotation key of the last applied pod template LastAppliedPodTemplate = "tikv.org/last-applied-podtemplate" // LastAppliedConfigAnnotation is annotation key of last applied configuration LastAppliedConfigAnnotation = "tikv.org/last-applied-configuration" )
Variables ¶
var ( TestStoreID string = "000" TestMemberID string = "111" TestClusterID string = "222" TestName string = "tikv-cluster" TestComponentName string = "tikv" TestPodName string = "pod-1" TestManagedByName string = "tikv-operator" TestClusterName string = "test" )
var ( // controllerKind contains the schema.GroupVersionKind for tikvcluster controller type. ControllerKind = v1alpha1.SchemeGroupVersion.WithKind("TikvCluster") // ClusterScoped controls whether operator should manage kubernetes cluster wide TiDB clusters ClusterScoped bool // TestMode defines whether tikv operator run in test mode, test mode is only open when test TestMode bool // ResyncDuration is the resync time of informer ResyncDuration time.Duration // PDDiscoveryImage is the image of pd discovery service PDDiscoveryImage string )
var ExternalTrafficPolicy string
ExternalTrafficPolicy denotes if this Service desires to route external traffic to node-local or cluster-wide endpoints.
Functions ¶
func AnnAdditionalProm ¶
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 ¶
func ContainerResource(req corev1.ResourceRequirements) corev1.ResourceRequirements
func DeploymentPodSpecChanged ¶
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 ¶
DiscoveryMemberName returns the name of tikv discovery
func EmptyClone ¶
EmptyClone create an clone of the resource with the same name and namespace (if namespace-scoped), with other fields unset
func GetDeploymentLastAppliedPodTemplate ¶
func GetDeploymentLastAppliedPodTemplate(dep *appsv1.Deployment) (*corev1.PodSpec, error)
GetDeploymentLastAppliedPodTemplate set last applied pod template from Deployment's annotation
func GetOwnerRef ¶
func GetOwnerRef(tc *v1alpha1.TikvCluster) metav1.OwnerReference
GetOwnerRef returns TikvCluster's OwnerReference
func GetPDClient ¶
func GetPDClient(pdControl pdapi.PDControlInterface, tc *v1alpha1.TikvCluster) pdapi.PDClient
GetPDClient gets the pd client from the TikvCluster
func GuaranteedUpdate ¶
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 ¶
IgnoreErrorf returns a IgnoreError
func InferObjectKind ¶
func InferObjectKind(obj runtime.Object) (schema.GroupVersionKind, error)
InferObjectKind infers the object kind
func IngressEqual ¶
func IngressEqual(newIngress, oldIngres *extensionsv1beta1.Ingress) (bool, error)
func IsIgnoreError ¶
IsIgnoreError returns whether err is a IgnoreError
func IsRequeueError ¶
IsRequeueError returns whether err is a RequeueError
func MemberConfigMapName ¶
func MemberConfigMapName(tc *v1alpha1.TikvCluster, member v1alpha1.MemberType) string
MemberConfigMapName returns the default ConfigMap name of the specified member type Deprecated TODO: remove after helm get totally abandoned
func NewFakePDClient ¶
func NewFakePDClient(pdControl *pdapi.FakePDControl, tc *v1alpha1.TikvCluster) *pdapi.FakePDClient
NewFakePDClient creates a fake pdclient that is set as the pd client
func PDMemberName ¶
PDMemberName returns pd member name
func PDPeerMemberName ¶
PDPeerMemberName returns pd peer service name
func ParseStorageRequest ¶
func ParseStorageRequest(req corev1.ResourceList) (corev1.ResourceRequirements, error)
func PumpMemberName ¶
PumpMemberName returns pump member name
func PumpPeerMemberName ¶
For backward compatibility, pump peer member name do not has -peer suffix PumpPeerMemberName returns pump peer service name
func RequeueErrorf ¶
RequeueErrorf returns a RequeueError
func ServiceEqual ¶
ServiceEqual compares the new Service's spec with old Service's last applied config
func SetServiceLastAppliedConfigAnnotation ¶
SetServiceLastAppliedConfigAnnotation set last applied config info to Service's annotation
func TiCDCMemberName ¶
TiCDCMemberName returns ticdc member name
func TiCDCPeerMemberName ¶
TiCDCPeerMemberName returns ticdc peer service name
func TiDBInitializerMemberName ¶
TiDBInitializerMemberName returns TiDBInitializer member name
func TiDBMemberName ¶
TiDBMemberName returns tikv member name
func TiDBPeerMemberName ¶
TiDBPeerMemberName returns tikv peer service name
func TiFlashMemberName ¶
TiFlashMemberName returns tiflash member name
func TiFlashPeerMemberName ¶
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 WatchForController ¶
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 ¶
func WatchForObject(informer cache.SharedIndexInformer, q workqueue.Interface)
WacthForObject watch the object change from informer and add it to workqueue
Types ¶
type ConfigMapControlInterface ¶
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 ¶
func NewRealConfigMapControl( kubeCli kubernetes.Interface, recorder record.EventRecorder, ) ConfigMapControlInterface
NewRealSecretControl creates a new SecretControlInterface
type FakeConfigMapControl ¶
type FakeConfigMapControl struct { CmIndexer cache.Indexer // contains filtered or unexported fields }
FakeConfigMapControl is a fake ConfigMapControlInterface
func NewFakeConfigMapControl ¶
func NewFakeConfigMapControl(cmInformer coreinformers.ConfigMapInformer) *FakeConfigMapControl
NewFakeConfigMapControl returns a FakeConfigMapControl
func (*FakeConfigMapControl) CreateConfigMap ¶
func (cc *FakeConfigMapControl) CreateConfigMap(_ runtime.Object, cm *corev1.ConfigMap) (*corev1.ConfigMap, error)
CreateConfigMap adds the ConfigMap to ConfigMapIndexer
func (*FakeConfigMapControl) DeleteConfigMap ¶
DeleteConfigMap deletes the ConfigMap of CmIndexer
func (*FakeConfigMapControl) GetConfigMap ¶
func (*FakeConfigMapControl) SetCreateConfigMapError ¶
func (cc *FakeConfigMapControl) SetCreateConfigMapError(err error, after int)
SetCreateConfigMapError sets the error attributes of createConfigMapTracker
func (*FakeConfigMapControl) SetDeleteConfigMapError ¶
func (cc *FakeConfigMapControl) SetDeleteConfigMapError(err error, after int)
SetDeleteConfigMapError sets the error attributes of deleteConfigMapTracker
func (*FakeConfigMapControl) SetUpdateConfigMapError ¶
func (cc *FakeConfigMapControl) SetUpdateConfigMapError(err error, after int)
SetUpdateConfigMapError sets the error attributes of updateConfigMapTracker
func (*FakeConfigMapControl) UpdateConfigMap ¶
func (cc *FakeConfigMapControl) UpdateConfigMap(_ runtime.Object, cm *corev1.ConfigMap) (*corev1.ConfigMap, error)
UpdateConfigMap updates the ConfigMap of CmIndexer
type FakeGeneralPVCControl ¶
type FakeGeneralPVCControl struct { PVCLister corelisters.PersistentVolumeClaimLister PVCIndexer cache.Indexer // contains filtered or unexported fields }
FakeGeneralPVCControl is a fake GeneralPVCControlInterface
func NewFakeGeneralPVCControl ¶
func NewFakeGeneralPVCControl(pvcInformer coreinformers.PersistentVolumeClaimInformer) *FakeGeneralPVCControl
NewFakeGeneralPVCControl returns a FakeGeneralPVCControl
func (*FakeGeneralPVCControl) CreatePVC ¶
func (fjc *FakeGeneralPVCControl) CreatePVC(_ runtime.Object, pvc *corev1.PersistentVolumeClaim) error
CreatePVC adds the pvc to PVCIndexer
func (*FakeGeneralPVCControl) SetCreatePVCError ¶
func (fjc *FakeGeneralPVCControl) SetCreatePVCError(err error, after int)
SetCreatePVCError sets the error attributes of createPVCTracker
type FakeGenericControl ¶
FakeGenericControl is a fake GenericControlInterface
func NewFakeGenericControl ¶
func NewFakeGenericControl(initObjects ...runtime.Object) *FakeGenericControl
NewFakeGenericControl returns a FakeGenericControl
func (*FakeGenericControl) AddObject ¶
func (gc *FakeGenericControl) AddObject(object runtime.Object) error
AddObject is used to prepare the indexer for fakeGenericControl
func (*FakeGenericControl) Create ¶
func (gc *FakeGenericControl) Create(controller, obj runtime.Object, setOwnerFlag bool) error
func (*FakeGenericControl) CreateOrUpdate ¶
func (*FakeGenericControl) Delete ¶
func (gc *FakeGenericControl) Delete(controller, obj runtime.Object) error
func (*FakeGenericControl) SetCreateError ¶
func (gc *FakeGenericControl) SetCreateError(err error, after int)
func (*FakeGenericControl) SetCreateOrUpdateError ¶
func (gc *FakeGenericControl) SetCreateOrUpdateError(err error, after int)
func (*FakeGenericControl) SetDeleteError ¶
func (gc *FakeGenericControl) SetDeleteError(err error, after int)
func (*FakeGenericControl) SetExistError ¶
func (gc *FakeGenericControl) SetExistError(err error, after int)
func (*FakeGenericControl) SetUpdateStatusError ¶
func (gc *FakeGenericControl) SetUpdateStatusError(err error, after int)
func (*FakeGenericControl) UpdateStatus ¶
func (gc *FakeGenericControl) UpdateStatus(obj runtime.Object) error
UpdateStatus update the /status subresource of object
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.TikvCluster, pvc *corev1.PersistentVolumeClaim) error
DeletePVC deletes the pvc
func (*FakePVCControl) GetPVC ¶
func (fpc *FakePVCControl) GetPVC(name, namespace string) (*corev1.PersistentVolumeClaim, error)
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.TikvCluster, pvc *corev1.PersistentVolumeClaim, pod *corev1.Pod) (*corev1.PersistentVolumeClaim, error)
UpdateMetaInfo updates the meta info of pvc
func (*FakePVCControl) UpdatePVC ¶
func (fpc *FakePVCControl) UpdatePVC(_ *v1alpha1.TikvCluster, 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) PatchPVReclaimPolicy ¶
func (fpc *FakePVControl) PatchPVReclaimPolicy(_ runtime.Object, 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(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) DeletePod ¶
func (fpc *FakePodControl) DeletePod(_ *v1alpha1.TikvCluster, pod *corev1.Pod) error
func (*FakePodControl) SetDeletePodError ¶
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.TikvCluster, pod *corev1.Pod) (*corev1.Pod, error)
UpdateMetaInfo update the meta info of Pod
func (*FakePodControl) UpdatePod ¶
func (fpc *FakePodControl) UpdatePod(_ *v1alpha1.TikvCluster, pod *corev1.Pod) (*corev1.Pod, error)
type FakeSecretControl ¶
type FakeSecretControl struct {
// contains filtered or unexported fields
}
type FakeServiceControl ¶
type FakeServiceControl struct { SvcLister corelisters.ServiceLister SvcIndexer cache.Indexer EpsIndexer cache.Indexer TcLister v1listers.TikvClusterLister TcIndexer cache.Indexer // contains filtered or unexported fields }
FakeServiceControl is a fake ServiceControlInterface
func NewFakeServiceControl ¶
func NewFakeServiceControl(svcInformer coreinformers.ServiceInformer, epsInformer coreinformers.EndpointsInformer, tcInformer tcinformers.TikvClusterInformer) *FakeServiceControl
NewFakeServiceControl returns a FakeServiceControl
func (*FakeServiceControl) CreateService ¶
func (ssc *FakeServiceControl) CreateService(_ *v1alpha1.TikvCluster, svc *corev1.Service) error
CreateService adds the service to SvcIndexer
func (*FakeServiceControl) DeleteService ¶
func (ssc *FakeServiceControl) DeleteService(_ *v1alpha1.TikvCluster, _ *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.TikvCluster, 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.TikvClusterLister TcIndexer cache.Indexer // contains filtered or unexported fields }
FakeStatefulSetControl is a fake StatefulSetControlInterface
func NewFakeStatefulSetControl ¶
func NewFakeStatefulSetControl(setInformer appsinformers.StatefulSetInformer, tcInformer tcinformers.TikvClusterInformer) *FakeStatefulSetControl
NewFakeStatefulSetControl returns a FakeStatefulSetControl
func (*FakeStatefulSetControl) CreateStatefulSet ¶
func (ssc *FakeStatefulSetControl) CreateStatefulSet(_ *v1alpha1.TikvCluster, set *apps.StatefulSet) error
CreateStatefulSet adds the statefulset to SetIndexer
func (*FakeStatefulSetControl) DeleteStatefulSet ¶
func (ssc *FakeStatefulSetControl) DeleteStatefulSet(_ *v1alpha1.TikvCluster, _ *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.TikvCluster, set *apps.StatefulSet) (*apps.StatefulSet, error)
UpdateStatefulSet updates the statefulset of SetIndexer
type FakeTikvClusterControl ¶
type FakeTikvClusterControl struct { TcLister listers.TikvClusterLister TcIndexer cache.Indexer // contains filtered or unexported fields }
FakeTikvClusterControl is a fake TikvClusterControlInterface
func NewFakeTikvClusterControl ¶
func NewFakeTikvClusterControl(tcInformer tcinformers.TikvClusterInformer) *FakeTikvClusterControl
NewFakeTikvClusterControl returns a FakeTikvClusterControl
func (*FakeTikvClusterControl) SetUpdateTikvClusterError ¶
func (ssc *FakeTikvClusterControl) SetUpdateTikvClusterError(err error, after int)
SetUpdateTikvClusterError sets the error attributes of updateTikvClusterTracker
func (*FakeTikvClusterControl) UpdateTikvCluster ¶
func (ssc *FakeTikvClusterControl) UpdateTikvCluster(tc *v1alpha1.TikvCluster, _ *v1alpha1.TikvClusterStatus, _ *v1alpha1.TikvClusterStatus) (*v1alpha1.TikvCluster, error)
UpdateTikvCluster updates the TikvCluster
type GeneralPVCControlInterface ¶
type GeneralPVCControlInterface interface {
CreatePVC(object runtime.Object, pvc *corev1.PersistentVolumeClaim) error
}
GeneralPVCControlInterface manages PVCs used in backup and restore's pvc
func NewRealGeneralPVCControl ¶
func NewRealGeneralPVCControl( kubeCli kubernetes.Interface, recorder record.EventRecorder, ) GeneralPVCControlInterface
NewRealGeneralPVCControl creates a new GeneralPVCControlInterface
type GenericControlInterface ¶
type GenericControlInterface interface { CreateOrUpdate(controller, obj runtime.Object, mergeFn MergeFn, setOwnerFlag bool) (runtime.Object, error) Create(controller, obj runtime.Object, setOwnerFlag bool) error UpdateStatus(obj runtime.Object) error Exist(key client.ObjectKey, obj runtime.Object) (bool, error) Delete(controller, obj runtime.Object) error }
GenericControlInterface manages generic object that managed by an arbitrary controller
func NewRealGenericControl ¶
func NewRealGenericControl(client client.Client, recorder record.EventRecorder) GenericControlInterface
type IgnoreError ¶
type IgnoreError struct {
// contains filtered or unexported fields
}
IgnoreError is used to ignore this item, this error type should't be considered as a real error, no need to requeue
func (*IgnoreError) Error ¶
func (re *IgnoreError) Error() string
type MergeFn ¶
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(*v1alpha1.TikvCluster, *corev1.PersistentVolumeClaim, *corev1.Pod) (*corev1.PersistentVolumeClaim, error) UpdatePVC(*v1alpha1.TikvCluster, *corev1.PersistentVolumeClaim) (*corev1.PersistentVolumeClaim, error) DeletePVC(*v1alpha1.TikvCluster, *corev1.PersistentVolumeClaim) error GetPVC(name, namespace string) (*corev1.PersistentVolumeClaim, error) }
PVCControlInterface manages PVCs used in TikvCluster
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) }
PVControlInterface manages PVs used in TikvCluster
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.TikvCluster, *corev1.Pod) (*corev1.Pod, error) DeletePod(*v1alpha1.TikvCluster, *corev1.Pod) error UpdatePod(*v1alpha1.TikvCluster, *corev1.Pod) (*corev1.Pod, error) }
PodControlInterface manages Pods used in TikvCluster
func NewRealPodControl ¶
func NewRealPodControl( kubeCli kubernetes.Interface, pdControl pdapi.PDControlInterface, podLister corelisters.PodLister, recorder record.EventRecorder, ) PodControlInterface
NewRealPodControl creates a new PodControlInterface
type RequestTracker ¶
type RequestTracker struct {
// contains filtered or unexported fields
}
RequestTracker is used by unit test for mocking request error
func (*RequestTracker) ErrorReady ¶
func (rt *RequestTracker) ErrorReady() bool
func (*RequestTracker) GetError ¶
func (rt *RequestTracker) GetError() error
func (*RequestTracker) GetRequests ¶
func (rt *RequestTracker) GetRequests() int
func (*RequestTracker) Inc ¶
func (rt *RequestTracker) Inc()
func (*RequestTracker) Reset ¶
func (rt *RequestTracker) Reset()
func (*RequestTracker) SetAfter ¶
func (rt *RequestTracker) SetAfter(after int) *RequestTracker
func (*RequestTracker) SetError ¶
func (rt *RequestTracker) SetError(err error) *RequestTracker
func (*RequestTracker) SetRequests ¶
func (rt *RequestTracker) SetRequests(requests int) *RequestTracker
type RequeueError ¶
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 ¶
func (re *RequeueError) Error() string
type SecretControlInterface ¶
type SecretControlInterface interface { Load(ns string, secretName string) ([]byte, []byte, error) Check(ns string, secretName string) bool }
SecretControlInterface manages certificates used by TiDB clusters
func NewFakeSecretControl ¶
func NewFakeSecretControl( kubeCli kubernetes.Interface, ) SecretControlInterface
func NewRealSecretControl ¶
func NewRealSecretControl( kubeCli kubernetes.Interface, ) SecretControlInterface
NewRealSecretControl creates a new SecretControlInterface
type ServiceControlInterface ¶
type ServiceControlInterface interface { CreateService(*v1alpha1.TikvCluster, *corev1.Service) error UpdateService(*v1alpha1.TikvCluster, *corev1.Service) (*corev1.Service, error) DeleteService(*v1alpha1.TikvCluster, *corev1.Service) error }
ServiceControlInterface manages Services used in TikvCluster
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 TikvCluster. CreateStatefulSet(*v1alpha1.TikvCluster, *apps.StatefulSet) error // UpdateStatefulSet updates a StatefulSet in a TikvCluster. UpdateStatefulSet(*v1alpha1.TikvCluster, *apps.StatefulSet) (*apps.StatefulSet, error) // DeleteStatefulSet deletes a StatefulSet in a TikvCluster. DeleteStatefulSet(*v1alpha1.TikvCluster, *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 TikvClusterControlInterface ¶
type TikvClusterControlInterface interface {
UpdateTikvCluster(*v1alpha1.TikvCluster, *v1alpha1.TikvClusterStatus, *v1alpha1.TikvClusterStatus) (*v1alpha1.TikvCluster, error)
}
TikvClusterControlInterface manages TikvClusters
func NewRealTikvClusterControl ¶
func NewRealTikvClusterControl(cli versioned.Interface, tcLister listers.TikvClusterLister, recorder record.EventRecorder) TikvClusterControlInterface
NewRealTikvClusterControl creates a new TikvClusterControlInterface
type TypedControlInterface ¶
type TypedControlInterface interface { // CreateOrUpdateSecret create the desired secret or update the current one to desired state if already existed CreateOrUpdateSecret(controller runtime.Object, secret *corev1.Secret) (*corev1.Secret, error) // CreateOrUpdateConfigMap create the desired configmap or update the current one to desired state if already existed CreateOrUpdateConfigMap(controller runtime.Object, cm *corev1.ConfigMap) (*corev1.ConfigMap, error) // CreateOrUpdateRole create the desired role or update the current one to desired state if already existed CreateOrUpdateRole(controller runtime.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 runtime.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 runtime.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 runtime.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 runtime.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 runtime.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 runtime.Object, ingress *extensionsv1beta1.Ingress) (*extensionsv1beta1.Ingress, error) // UpdateStatus update the /status subresource of the object UpdateStatus(newStatus runtime.Object) error // Delete delete the given object from the cluster Delete(controller, obj runtime.Object) error // Create create the given object for the controller Create(controller, obj runtime.Object) error // Exist check whether object exists Exist(key client.ObjectKey, obj runtime.Object) (bool, error) }
GenericControlInterface is a wrapper to manage typed object that managed by an arbitrary controller
func NewTypedControl ¶
func NewTypedControl(control GenericControlInterface) TypedControlInterface
NewTypedControl wraps a GenericControlInterface to a TypedControlInterface