ctrl

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Client

func Client(ctx context.Context) *k8s.Client

func Logger

func Logger(ctx context.Context) *slog.Logger

func RootLogger

func RootLogger(ctx context.Context) *slog.Logger

Types

type Event

type Event struct {
	Name      string
	Namespace string
	// contains filtered or unexported fields
}

func (Event) String

func (event Event) String() string

type HandleFunc

type HandleFunc func(context.Context, Event) (Result, error)

type Instance

type Instance struct {
	Client      *k8s.Client
	Logger      *slog.Logger
	Concurrency int
}

func (Instance) ProcessGroupKind

func (ctrl Instance) ProcessGroupKind(ctx context.Context, gk schema.GroupKind, handler HandleFunc) error

type Queue

type Queue[T fmt.Stringer] struct {
	// contains filtered or unexported fields
}

func QueueFromChannel

func QueueFromChannel[T fmt.Stringer](c chan T) (*Queue[T], func())

QueueFromChannel returns a queue that will dedup events based on its string representation as determined by fmt.Stringer.

func (*Queue[T]) C

func (queue *Queue[T]) C() (chan T, func())

func (*Queue[T]) Dequeue

func (queue *Queue[T]) Dequeue() (value T)

func (*Queue[T]) Enqueue

func (queue *Queue[T]) Enqueue(value T)

type Result

type Result struct {
	Requeue      bool
	RequeueAfter time.Duration
}

Jump to

Keyboard shortcuts

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