ctrl

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2025 License: MIT Imports: 20 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 {
	Params
	// contains filtered or unexported fields
}

func NewController added in v0.6.4

func NewController(ctx context.Context, params Params) (Instance, error)

func (Instance) Run added in v0.6.4

func (ctrl Instance) Run() error

type Params added in v0.6.4

type Params struct {
	GK          schema.GroupKind
	Handler     HandleFunc
	Client      *k8s.Client
	Logger      *slog.Logger
	Concurrency int
}

type Queue

type Queue[T fmt.Stringer] struct {
	C chan T
	// 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]) 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