task

package
v0.0.0-...-0e8ba2f Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const MinInterval = 1 * time.Millisecond

MinInterval is the minimum allowed interval for task runners to prevent panics from time.NewTicker(0).

Variables

This section is empty.

Functions

This section is empty.

Types

type Runner

type Runner struct {
	// The kubernetes client to use.
	Client client.Client
	// The interval at which to run the task.
	Interval time.Duration
	// The name of the task.
	Name string

	// If set, this function is called once at the start of the runner.
	Init func(ctx context.Context) error
	// If set, this function is called on each task run.
	Run func(ctx context.Context) error
	// contains filtered or unexported fields
}

Runner is a generic task runner that can be used to run periodic tasks in the controller-runtime manager. The runner acts as a controller that watches for generic events and triggers the task run on each event. In this way, it is properly integrated with the manager lifecycle and can leverage the controller-runtime features.

func (*Runner) Reconcile

func (r *Runner) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile is called when an event is received to trigger the task run.

func (*Runner) SetupWithManager

func (r *Runner) SetupWithManager(mgr manager.Manager) error

SetupWithManager sets up the task runner with the controller-runtime manager.

func (*Runner) Start

func (r *Runner) Start(ctx context.Context) error

Start starts the task runner, which will send events at the specified interval.

Jump to

Keyboard shortcuts

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