Documentation
¶
Index ¶
- Constants
- Variables
- func CalcGracePeriod(regionCount int) int64
- func ConfigMapName(podName string) string
- func DeletePodWithGracePeriod(ctx context.Context, c client.Client, pod *corev1.Pod, regionCount int) error
- func IsStoreReady(s State) bool
- func PVCNewer() common.PVCNewer[*v1alpha1.TiKV]
- func TaskConfigMap(state *ReconcileContext, c client.Client) task.Task
- func TaskContextInfoFromPD(state *ReconcileContext, cm pdm.PDClientManager) task.Task
- func TaskEndEvictLeader(state *ReconcileContext, m pdm.PDClientManager) task.Task
- func TaskEvictLeader(state *ReconcileContext, m pdm.PDClientManager) task.Task
- func TaskOfflineStore(state *ReconcileContext, m pdm.PDClientManager) task.Task
- func TaskPod(state *ReconcileContext, c client.Client) task.Task
- func TaskStatus(state *ReconcileContext, c client.Client) task.Task
- func TaskStoreLabels(state *ReconcileContext, c client.Client, m pdm.PDClientManager) task.Task
- func TaskSuspendPod(state *ReconcileContext, c client.Client) task.Task
- func VolumeMount(name string, mount *v1alpha1.VolumeMount) *corev1.VolumeMount
- func VolumeName(volName string) string
- type ReconcileContext
- type State
Constants ¶
View Source
const ( MinGracePeriodSeconds = 30 // Assume that approximately 200 regions are transferred for 1s RegionsPerSecond = 200 )
Variables ¶
View Source
var SubresourceLister = common.NewSubresourceLister( common.NewSubresource[corev1.PodList](client.GracePeriodSeconds(defaultGracePeriod)), common.NewSubresource[corev1.ConfigMapList](), common.NewSubresource[corev1.PersistentVolumeClaimList](), )
Functions ¶
func CalcGracePeriod ¶
func ConfigMapName ¶
func IsStoreReady ¶
func TaskConfigMap ¶
func TaskConfigMap(state *ReconcileContext, c client.Client) task.Task
func TaskContextInfoFromPD ¶
func TaskContextInfoFromPD(state *ReconcileContext, cm pdm.PDClientManager) task.Task
func TaskEndEvictLeader ¶
func TaskEndEvictLeader(state *ReconcileContext, m pdm.PDClientManager) task.Task
TaskEndEvictLeader only be called when object is deleting and store has been removed TODO(liubo02): it's not stable because status.ID may be lost
func TaskEvictLeader ¶
func TaskEvictLeader(state *ReconcileContext, m pdm.PDClientManager) task.Task
func TaskOfflineStore ¶
func TaskOfflineStore(state *ReconcileContext, m pdm.PDClientManager) task.Task
func TaskStatus ¶
func TaskStatus(state *ReconcileContext, c client.Client) task.Task
TODO(liubo02): extract to common task
func TaskStoreLabels ¶
func TaskStoreLabels(state *ReconcileContext, c client.Client, m pdm.PDClientManager) task.Task
func TaskSuspendPod ¶
func TaskSuspendPod(state *ReconcileContext, c client.Client) task.Task
func VolumeMount ¶
func VolumeMount(name string, mount *v1alpha1.VolumeMount) *corev1.VolumeMount
func VolumeName ¶
VolumeName returns the real spec.volumes[*].name of pod TODO(liubo02): extract to namer pkg
Types ¶
type ReconcileContext ¶
type ReconcileContext struct {
State
LeaderEvicting bool
Store *pdv1.Store
PDSynced bool
// IsStoreReady will be set only when pd is synced and the store is ok
// It may be outdated so the tikv is healthy only when the pod is also available
// If it's true and the pod is ready but not available,
// the operator will retry to avoid unexpectedly missing next reconciliation
IsStoreReady bool
}
func (*ReconcileContext) GetStoreID ¶
func (r *ReconcileContext) GetStoreID() string
GetStoreID returns the store ID for PD operations
func (*ReconcileContext) StoreNotExists ¶
func (r *ReconcileContext) StoreNotExists() bool
StoreNotExists returns true if the store does not exist in PD
type State ¶
type State interface {
common.TiKVState
common.ClusterState
common.ObjectState[*v1alpha1.TiKV]
common.PodState
common.PodStateUpdater
common.InstanceState[*runtime.TiKV]
common.ContextClusterNewer[*v1alpha1.TiKV]
common.ContextObjectNewer[*v1alpha1.TiKV]
common.StatusUpdater
common.StatusPersister[*v1alpha1.TiKV]
common.StoreState
common.StoreStateUpdater
common.HealthyState
common.HealthyStateUpdater
stateutil.IFeatureGates
stateutil.IPDClient
}
func NewState ¶
func NewState(key types.NamespacedName) State
Click to show internal directories.
Click to hide internal directories.