waiter

package
v2.1.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Poll = time.Second * 5

	ShortTaskTimeout = time.Minute * 3
	LongTaskTimeout  = time.Minute * 10
)

Functions

func EvictLeaderBeforeStoreIsRemoving

func EvictLeaderBeforeStoreIsRemoving(deleting int) func(kv *v1alpha1.TiKV) (bool, error)

func ListCondition

func ListCondition[
	S scope.Instance[F, T],
	F client.Object,
	T runtime.Instance,
](condType string, status metav1.ConditionStatus) func(items []F) error

func ListIsEmpty

func ListIsEmpty[I client.Object](items []I) error

func ListIsRecreated

func ListIsRecreated[I client.Object](changeTime time.Time) func(items []I) error

func MaxPodsCreateTimestamp

func MaxPodsCreateTimestamp[
	S scope.Group[F, T],
	F client.Object,
	T runtime.Group,
](
	ctx context.Context,
	c client.Client,
	g F,
) (*time.Time, error)

func OneDeleting

func OneDeleting[I client.Object](target *I) func(items []I) error

func PDHasLeader

func PDHasLeader(items []*v1alpha1.PD) error

func WaitForClusterPDRegistered

func WaitForClusterPDRegistered(ctx context.Context, c client.Client, tc *v1alpha1.Cluster, timeout time.Duration) error

func WaitForClusterReady

func WaitForClusterReady(ctx context.Context, c client.Client, ns, name string, timeout time.Duration) error

func WaitForInstance

func WaitForInstance[
	S scope.Instance[F, T],
	F client.Object,
	T runtime.Instance,
](
	ctx context.Context,
	c client.Client,
	instance F,
	cond func(instance F) error,
	timeout time.Duration,
) error

func WaitForInstanceList

func WaitForInstanceList[
	GS scope.GroupInstance[GF, GT, IS],
	IS scope.List[IL, I],
	GF client.Object,
	GT runtime.Group,
	IL client.ObjectList,
	I client.Object,
](
	ctx context.Context,
	c client.Client,
	g GF,
	cond func(items []I) error,
	timeout time.Duration,
) error

func WaitForInstanceListCondition

func WaitForInstanceListCondition[
	GS scope.GroupInstance[GF, GT, IS],
	IS scope.InstanceList[IF, IT, IL],
	GF client.Object,
	GT runtime.Group,
	IF client.Object,
	IT runtime.Instance,
	IL client.ObjectList,
](
	ctx context.Context,
	c client.Client,
	g GF,
	condType string,
	status metav1.ConditionStatus,
	timeout time.Duration,
) error

func WaitForInstanceListDeleted

func WaitForInstanceListDeleted[
	GS scope.GroupInstance[GF, GT, IS],
	IS scope.List[IL, I],
	GF client.Object,
	GT runtime.Group,
	IL client.ObjectList,
	I client.Object,
](
	ctx context.Context,
	c client.Client,
	g GF,
	timeout time.Duration,
) error

func WaitForInstanceListRecreated

func WaitForInstanceListRecreated[
	GS scope.GroupInstance[GF, GT, IS],
	IS scope.List[IL, I],
	GF client.Object,
	GT runtime.Group,
	IL client.ObjectList,
	I client.Object,
](
	ctx context.Context,
	c client.Client,
	g GF,
	changeTime time.Time,
	timeout time.Duration,
) error

func WaitForJobComplete

func WaitForJobComplete(ctx context.Context, c client.Client, job *batchv1.Job, timeout time.Duration) error

func WaitForJobRunning

func WaitForJobRunning(ctx context.Context, c client.Client, job *batchv1.Job, timeout time.Duration) error

func WaitForList

func WaitForList(
	ctx context.Context,
	c client.Client,
	list client.ObjectList,
	cond func() error,
	timeout time.Duration,
	opts ...client.ListOption,
) error

func WaitForListDeleted

func WaitForListDeleted(
	ctx context.Context,
	c client.Client,
	list client.ObjectList,
	timeout time.Duration,
	opts ...client.ListOption,
) error

func WaitForObject

func WaitForObject(
	ctx context.Context,
	c client.Client,
	obj client.Object,
	cond func() error,
	timeout time.Duration,
) error

func WaitForObjectCondition

func WaitForObjectCondition[
	S scope.Object[F, T],
	F client.Object,
	T runtime.Object,
](
	ctx context.Context,
	c client.Client,
	obj F,
	condType string,
	status metav1.ConditionStatus,
	timeout time.Duration,
) error

func WaitForObjectDeleted

func WaitForObjectDeleted(
	ctx context.Context,
	c client.Client,
	obj client.Object,
	timeout time.Duration,
) error

func WaitForObjectV2

func WaitForObjectV2(
	ctx context.Context,
	c client.Client,
	obj client.Object,
	cond func() (stop bool, _ error),
	timeout time.Duration,
) error

func WaitForOneInstanceDeleting

func WaitForOneInstanceDeleting[
	GS scope.GroupInstance[GF, GT, IS],
	IS scope.List[IL, I],
	GF client.Object,
	GT runtime.Group,
	IL client.ObjectList,
	I client.Object,
](
	ctx context.Context,
	c client.Client,
	g GF,
	target *I,
	timeout time.Duration,
) error

func WaitForPDsHealthy

func WaitForPDsHealthy(ctx context.Context, c client.Client, pdg *v1alpha1.PDGroup, timeout time.Duration) error

func WaitForPodReadyInNamespace

func WaitForPodReadyInNamespace(ctx context.Context, c client.Client, pod *corev1.Pod, timeout time.Duration) error

WaitForPodReadyInNamespace waits the given timeout duration for the specified pod to be ready and running.

func WaitForPodsCondition

func WaitForPodsCondition[G runtime.Group](
	ctx context.Context,
	c client.Client,
	g G,
	cond func(pod *corev1.Pod) error,
	timeout time.Duration,
) error

func WaitForPodsReady

func WaitForPodsReady[G runtime.Group](ctx context.Context, c client.Client, g G, timeout time.Duration) error

func WaitForPodsRecreated

func WaitForPodsRecreated[G runtime.Group](
	ctx context.Context,
	c client.Client,
	g G,
	changeTime time.Time,
	timeout time.Duration,
) error

func WaitForResourceManagersHealthy

func WaitForResourceManagersHealthy(ctx context.Context, c client.Client, rmg *v1alpha1.ResourceManagerGroup, timeout time.Duration) error

func WaitForRoutersHealthy

func WaitForRoutersHealthy(ctx context.Context, c client.Client, rg *v1alpha1.RouterGroup, timeout time.Duration) error

func WaitForSchedulingsHealthy

func WaitForSchedulingsHealthy(ctx context.Context, c client.Client, sg *v1alpha1.SchedulingGroup, timeout time.Duration) error

func WaitForTSOsHealthy

func WaitForTSOsHealthy(ctx context.Context, c client.Client, tg *v1alpha1.TSOGroup, timeout time.Duration) error

func WaitForTiCDCsHealthy

func WaitForTiCDCsHealthy(ctx context.Context, c client.Client, cg *v1alpha1.TiCDCGroup, timeout time.Duration) error

func WaitForTiDBsHealthy

func WaitForTiDBsHealthy(ctx context.Context, c client.Client, dbg *v1alpha1.TiDBGroup, timeout time.Duration) error

func WaitForTiFlashOfflineCompleted

func WaitForTiFlashOfflineCompleted(expectTiFlash *v1alpha1.TiFlash) func(flash *v1alpha1.TiFlash) (bool, error)

func WaitForTiFlashesHealthy

func WaitForTiFlashesHealthy(ctx context.Context, c client.Client, fg *v1alpha1.TiFlashGroup, timeout time.Duration) error

func WaitForTiKVOfflineCompleted

func WaitForTiKVOfflineCompleted(expectTiKV *v1alpha1.TiKV) func(kv *v1alpha1.TiKV) (bool, error)

func WaitForTiKVWorkersHealthy

func WaitForTiKVWorkersHealthy(ctx context.Context, c client.Client, wg *v1alpha1.TiKVWorkerGroup, timeout time.Duration) error

func WaitForTiKVsHealthy

func WaitForTiKVsHealthy(ctx context.Context, c client.Client, kvg *v1alpha1.TiKVGroup, timeout time.Duration) error

func WaitForTiProxysHealthy

func WaitForTiProxysHealthy(ctx context.Context, c client.Client, proxyg *v1alpha1.TiProxyGroup, timeout time.Duration) error

func WaitPodsRollingUpdateOnce

func WaitPodsRollingUpdateOnce[
	S scope.Group[F, T],
	F client.Object,
	T runtime.Group,
](
	ctx context.Context,
	c client.Client,
	g F,
	to int,
	surge int,
	timeout time.Duration,
) error

nolint: gocyclo // optimize later

func WatchUntilInstanceList

func WatchUntilInstanceList[
	GS scope.GroupInstance[GF, GT, IS],
	IS scope.List[IL, PI],
	GF client.Object,
	GT runtime.Group,
	IL client.ObjectList,
	PI scope.ClientObject[I],
	I any,
](
	ctx context.Context,
	c client.Client,
	g GF,
	cond func(item PI) (bool, error),
	timeout time.Duration,
	synced chan struct{},
) error

WatchUntilInstanceList use watch to ensure something is not happened

Types

This section is empty.

Jump to

Keyboard shortcuts

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