Documentation ¶
Index ¶
- Constants
- func TestRunSynchronously(t *testing.T, controller Controller)
- func TestSync(t *testing.T, controller Controller, ctx Context) error
- func TestWrap(t *testing.T, controller Controller, wrapper SyncWrapperFunc)
- type Config
- type Context
- type Controller
- type Filter
- type FilterFuncs
- type InformerGetter
- type InformerOption
- type Key
- type Manager
- type Option
- type ParentFunc
- type Queue
- type SyncFunc
- type SyncWrapperFunc
- type Syncer
Constants ¶
View Source
const ErrSyntheticRequeue = constErr("synthetic requeue request")
ErrSyntheticRequeue can be returned from a Syncer to force a retry artificially for the current key. This can also be done by re-adding the key to queue, but this is more convenient and has better logging.
Variables ¶
This section is empty.
Functions ¶
func TestRunSynchronously ¶
func TestRunSynchronously(t *testing.T, controller Controller)
Just enough of the internal implementation of controller.Run() to allow "running" the controller without any goroutines being involved. For use in synchronous unit tests that wish to invoke TestSync() directly.
func TestWrap ¶
func TestWrap(t *testing.T, controller Controller, wrapper SyncWrapperFunc)
Types ¶
type Controller ¶
type Controller interface { // Run runs the controller and blocks until the controller is finished. // Number of workers can be specified via workers parameter. // This function will return when all internal loops are finished. // Note that having more than one worker usually means handing parallelization of Sync(). Run(ctx context.Context, workers int) // Name returns the controller name string. Name() string // contains filtered or unexported methods }
Controller interface represents a runnable Kubernetes controller. Cancelling the context passed will cause the controller to shutdown. Number of workers determine how much parallel the job processing should be.
func New ¶
func New(config Config, opts ...Option) Controller
type Filter ¶
type Filter interface { Add(obj metav1.Object) bool Update(oldObj, newObj metav1.Object) bool Delete(obj metav1.Object) bool Parent(obj metav1.Object) Key }
func FilterByNames ¶
func FilterByNames(parentFunc ParentFunc, names ...string) Filter
type FilterFuncs ¶
type InformerGetter ¶
type InformerGetter interface {
Informer() cache.SharedIndexInformer
}
type InformerOption ¶
type Manager ¶
type Manager interface { Start(ctx context.Context) WithController(controller Controller, workers int) Manager }
func NewManager ¶
func NewManager() Manager
type Option ¶
type Option func(*controller)
func WithInformer ¶
func WithInformer(getter InformerGetter, filter Filter, opt InformerOption) Option
func WithInitialEvent ¶
func WithMaxRetries ¶
func WithRateLimiter ¶
func WithRateLimiter(limiter workqueue.RateLimiter) Option
func WithRecorder ¶
func WithRecorder(recorder events.EventRecorder) Option
type ParentFunc ¶
type Queue ¶
type Queue interface { // Add immediately adds a key to the queue and marks it as needing processing. Add(key Key) // AddRateLimited adds a key to the queue after the rate limiter says it is ok. AddRateLimited(key Key) // AddAfter adds a key to the queue after the indicated duration has passed. AddAfter(key Key, duration time.Duration) }
type SyncWrapperFunc ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.