controller

package
Version: v0.0.0-...-6c6cd7f Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2021 License: Apache-2.0 Imports: 20 Imported by: 117

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

This section is empty.

Types

type Controller

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

func New

func New(name string, informer cache.SharedIndexInformer, startCache func(context.Context) error, handler Handler, opts *Options) Controller

type Handler

type Handler interface {
	OnChange(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.RateLimiter
}

type SharedController

type SharedController interface {
	Controller

	RegisterHandler(ctx context.Context, name string, handler SharedControllerHandler)
	Client() *client.Client
}

type SharedControllerFactory

type SharedControllerFactory interface {
	ForObject(obj runtime.Object) (SharedController, error)
	ForKind(gvk schema.GroupVersionKind) (SharedController, error)
	ForResource(gvr schema.GroupVersionResource, namespaced bool) SharedController
	ForResourceKind(gvr schema.GroupVersionResource, kind string, namespaced bool) SharedController
	SharedCacheFactory() cache.SharedCacheFactory
	Start(ctx context.Context, workers int) error
}

func NewSharedControllerFactoryFromConfig

func NewSharedControllerFactoryFromConfig(config *rest.Config, scheme *runtime.Scheme) (SharedControllerFactory, error)

type SharedControllerFactoryOptions

type SharedControllerFactoryOptions struct {
	DefaultRateLimiter workqueue.RateLimiter
	DefaultWorkers     int

	KindRateLimiter map[schema.GroupVersionKind]workqueue.RateLimiter
	KindWorkers     map[schema.GroupVersionKind]int
}

type SharedControllerHandler

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

type SharedControllerHandlerFunc

type SharedControllerHandlerFunc func(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(key string, obj runtime.Object) error

func (*SharedHandler) Register

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

Jump to

Keyboard shortcuts

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