runtime

package
v0.0.0-...-1b92784 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2025 License: Apache-2.0 Imports: 39 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultThreadiness = 10
)
View Source
var (
	ErrIgnore = errors.New("ignore handler error")
)

Functions

func CopyInto

func CopyInto(dst, src runtime.Object) error

func KeyParse

func KeyParse(key string) (namespace string, name string)

Types

type Backend

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

func (Backend) Create

func (c Backend) Create(ctx context.Context, obj kclient.Object, opts ...kclient.CreateOption) error

func (Backend) Delete

func (c Backend) Delete(ctx context.Context, obj kclient.Object, opts ...kclient.DeleteOption) error

func (Backend) DeleteAllOf

func (c Backend) DeleteAllOf(ctx context.Context, obj kclient.Object, opts ...kclient.DeleteAllOfOption) error

func (*Backend) GVKForObject

func (b *Backend) GVKForObject(obj runtime.Object, scheme *runtime.Scheme) (schema.GroupVersionKind, error)

func (Backend) Get

func (c Backend) Get(ctx context.Context, key kclient.ObjectKey, obj kclient.Object, opts ...kclient.GetOption) error

func (*Backend) GetInformerForKind

func (b *Backend) GetInformerForKind(ctx context.Context, gvk schema.GroupVersionKind) (kcache.SharedIndexInformer, error)

func (*Backend) GroupVersionKindFor

func (b *Backend) GroupVersionKindFor(obj runtime.Object) (schema.GroupVersionKind, error)

func (*Backend) IndexField

func (b *Backend) IndexField(ctx context.Context, obj kclient.Object, field string, extractValue kclient.IndexerFunc) error

func (*Backend) IsObjectNamespaced

func (b *Backend) IsObjectNamespaced(obj runtime.Object) (bool, error)

func (Backend) List

func (c Backend) List(ctx context.Context, list kclient.ObjectList, opts ...kclient.ListOption) error

func (Backend) Patch

func (c Backend) Patch(ctx context.Context, obj kclient.Object, patch kclient.Patch, opts ...kclient.PatchOption) error

func (*Backend) Preload

func (b *Backend) Preload(ctx context.Context) error

func (Backend) RESTMapper

func (c Backend) RESTMapper() meta.RESTMapper

func (Backend) Scheme

func (c Backend) Scheme() *runtime.Scheme

func (*Backend) Start

func (b *Backend) Start(ctx context.Context) error

func (Backend) Status

func (c Backend) Status() kclient.StatusWriter

func (Backend) SubResource

func (c Backend) SubResource(subResource string) kclient.SubResourceClient

func (*Backend) Trigger

func (b *Backend) Trigger(ctx context.Context, gvk schema.GroupVersionKind, key string, delay time.Duration) error

func (Backend) Update

func (c Backend) Update(ctx context.Context, obj kclient.Object, opts ...kclient.UpdateOption) error

func (Backend) Watch

func (c Backend) Watch(ctx context.Context, obj kclient.ObjectList, opts ...kclient.ListOption) (watch.Interface, error)

func (*Backend) Watcher

func (b *Backend) Watcher(ctx context.Context, gvk schema.GroupVersionKind, name string, cb backend.Callback) error

type Config

type Config struct {
	Rest              *rest.Config
	Namespace         string
	FieldSelector     fields.Selector
	LabelSelector     labels.Selector
	ByObject          map[client.Object]cache.ByObject
	GVKThreadiness    map[schema.GroupVersionKind]int
	GVKQueueSplitters map[schema.GroupVersionKind]WorkerQueueSplitter
}

type Controller

type Controller interface {
	Enqueue(namespace, name string)
	EnqueueAfter(namespace, name string, delay time.Duration)
	EnqueueKey(key string)
	EnqueueKeyAfter(key string, delay time.Duration)
	Cache() (cache.Cache, error)
	Start(ctx context.Context, workers int) error
}

func New

func New(ctx context.Context, gvk schema.GroupVersionKind, scheme *runtime.Scheme, cache cache.Cache, handler Handler, opts *Options) (Controller, error)

type Handler

type Handler interface {
	OnChange(ctx context.Context, key string, obj runtime.Object) error
}

type HandlerFunc

type HandlerFunc func(key string, obj runtime.Object) error

func (HandlerFunc) OnChange

func (h HandlerFunc) OnChange(key string, obj runtime.Object) error

type HandlerTransaction

type HandlerTransaction struct {
	context.Context
	// contains filtered or unexported fields
}

func NewHandlerTransaction

func NewHandlerTransaction(ctx context.Context) *HandlerTransaction

func (*HandlerTransaction) Commit

func (h *HandlerTransaction) Commit()

func (*HandlerTransaction) Rollback

func (h *HandlerTransaction) Rollback()

type Options

type Options struct {
	RateLimiter   workqueue.TypedRateLimiter[any]
	QueueSplitter WorkerQueueSplitter
}

type ResourceVersionGetter

type ResourceVersionGetter interface {
	GetResourceVersion() string
}

type Runtime

type Runtime struct {
	Backend *Backend
}

func NewRuntime

func NewRuntime(cfg *rest.Config, scheme *runtime.Scheme) (*Runtime, error)

func NewRuntimeForNamespace

func NewRuntimeForNamespace(cfg *rest.Config, namespace string, scheme *runtime.Scheme) (*Runtime, error)

func NewRuntimeWithConfig

func NewRuntimeWithConfig(cfg Config, scheme *runtime.Scheme) (*Runtime, error)

type SharedController

type SharedController interface {
	Controller

	RegisterHandler(ctx context.Context, name string, handler SharedControllerHandler) error
}

type SharedControllerFactory

type SharedControllerFactory interface {
	ForKind(ctx context.Context, gvk schema.GroupVersionKind) (SharedController, error)
	Preload(ctx context.Context) error
	Start(ctx context.Context) error
}

type SharedControllerFactoryOptions

type SharedControllerFactoryOptions struct {
	DefaultRateLimiter workqueue.TypedRateLimiter[any]
	DefaultWorkers     int

	KindRateLimiter   map[schema.GroupVersionKind]workqueue.TypedRateLimiter[any]
	KindWorkers       map[schema.GroupVersionKind]int
	KindQueueSplitter map[schema.GroupVersionKind]WorkerQueueSplitter
}

type SharedControllerHandler

type SharedControllerHandler interface {
	OnChange(ctx context.Context, key string, obj runtime.Object) (runtime.Object, error)
}

type SharedControllerHandlerFunc

type SharedControllerHandlerFunc func(ctx context.Context, key string, obj runtime.Object) (runtime.Object, error)

func (SharedControllerHandlerFunc) OnChange

type SharedHandler

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

func (*SharedHandler) OnChange

func (h *SharedHandler) OnChange(ctx context.Context, key string, obj runtime.Object) error

func (*SharedHandler) Register

func (h *SharedHandler) Register(ctx context.Context, name string, handler SharedControllerHandler)

type WorkerQueueSplitter

type WorkerQueueSplitter interface {
	Queues() int
	Split(key string) int
}

Jump to

Keyboard shortcuts

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