watch

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package watch contains a generic watcher that implements manager.Runnable

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConditionFunc

type ConditionFunc func(ctx context.Context, c client.Client) (bool, error)

ConditionFunc checks if a condition is met Returns (conditionMet, error)

type Config

type Config struct {
	Client    client.Client
	Log       logr.Logger
	Interval  time.Duration
	Timeout   time.Duration
	Name      string
	Condition ConditionFunc
	Handler   HandlerFunc
}

Config for creating a new ResourceWatcher

type HandlerFunc

type HandlerFunc func(ctx context.Context, c client.Client) error

HandlerFunc is called when the condition is met

type ResourceWatcher

type ResourceWatcher struct {
	// contains filtered or unexported fields
}

ResourceWatcher periodically checks a condition and triggers a handler

func New

func New(cfg Config) (*ResourceWatcher, error)

New creates a new ResourceWatcher. Returns an error if misconfigured.

func NewOrDie

func NewOrDie(cfg Config) *ResourceWatcher

NewOrDie creates a new ResourceWatcher. Panics if misconfigured.

func (*ResourceWatcher) Start

func (w *ResourceWatcher) Start(ctx context.Context) error

Start begins the watch loop

Jump to

Keyboard shortcuts

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