Documentation ¶
Index ¶
- func PassthroughKeyFunc(obj interface{}) (interface{}, error)
- type KeyFunc
- type Result
- type SyncHandler
- type SyncQueue
- func (sq *SyncQueue) Dequeue(obj interface{})
- func (sq *SyncQueue) Enqueue(obj interface{})
- func (sq *SyncQueue) EnqueueAfter(obj interface{}, after time.Duration)
- func (sq *SyncQueue) EnqueueRateLimited(obj interface{})
- func (sq *SyncQueue) FilteringResourceEventHandler(scheme *runtime.Scheme, filter func(obj interface{}) bool) cache.ResourceEventHandler
- func (sq *SyncQueue) IsShuttingDown() bool
- func (sq *SyncQueue) Queue() workqueue.RateLimitingInterface
- func (sq *SyncQueue) ResourceEventHandler(scheme *runtime.Scheme) cache.ResourceEventHandler
- func (sq *SyncQueue) Run(workers int)
- func (sq *SyncQueue) SetMaxErrRetries(max int)
- func (sq *SyncQueue) ShutDown()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PassthroughKeyFunc ¶
func PassthroughKeyFunc(obj interface{}) (interface{}, error)
PassthroughKeyFunc is a keyFunc which returns the original obj
Types ¶
type KeyFunc ¶
type KeyFunc func(obj interface{}) (interface{}, error)
KeyFunc describes a function that generates a key from a object
type Result ¶
type Result struct { // Requeue tells the Queue to requeue the object. Defaults to false. Requeue bool // RequeueAfter if greater than 0, tells the Queue to requeue the object after the Duration. // Implies that Requeue is true, there is no need to set Requeue to true at the same time as RequeueAfter. RequeueAfter time.Duration // MaxRequeueTimes tells the Queue the limit count of requeueing object. Defaults to 0. // It only take effect when Requeue is true or RequeueAfter is greater than 0. MaxRequeueTimes int }
Result contains the result of a Reconciler invocation.
type SyncHandler ¶
SyncHandler describes the function which will be called for each item in the queue
if the sync handler returns an *ErrRetryAfter error, the queue will put obj back and retry after a period of time
type SyncQueue ¶
type SyncQueue struct {
// contains filtered or unexported fields
}
SyncQueue is a helper for creating a kubernetes controller easily It requires a syncHandler and an optional key function. After running the syncQueue, you can call it's Enqueque function to enqueue items. SyncQueue will get key from the items by keyFunc, and add the key to the rate limit workqueue. The worker will be invoked to call the syncHandler.
func NewCustomSyncQueue ¶
func NewCustomSyncQueue(gvk schema.GroupVersionKind, syncHandler SyncHandler, keyFunc KeyFunc) *SyncQueue
NewCustomSyncQueue returns a new SyncQueue using custom keyFunc
func NewPassthroughSyncQueue ¶
func NewPassthroughSyncQueue(gvk schema.GroupVersionKind, syncHandler SyncHandler) *SyncQueue
NewPassthroughSyncQueue returns a new SyncQueue with PassthroughKeyFunc
func NewSyncQueue ¶
func NewSyncQueue(gvk schema.GroupVersionKind, syncHandler SyncHandler) *SyncQueue
NewSyncQueue returns a new SyncQueue, enqueue key of obj using default keyFunc
func (*SyncQueue) Dequeue ¶
func (sq *SyncQueue) Dequeue(obj interface{})
Dequeue calls the RateLimitingInterface.Froget and Done to stop tracking the item
func (*SyncQueue) EnqueueAfter ¶
EnqueueAfter wraps queue.AddAfter. It adds an item to the workqueue after the indicated duration has passed
func (*SyncQueue) EnqueueRateLimited ¶
func (sq *SyncQueue) EnqueueRateLimited(obj interface{})
EnqueueRateLimited wraps queue.AddRateLimited. It adds an item to the workqueue after the rate limiter says its ok
func (*SyncQueue) FilteringResourceEventHandler ¶
func (*SyncQueue) IsShuttingDown ¶
IsShuttingDown returns if the method Shutdown was invoked
func (*SyncQueue) Queue ¶
func (sq *SyncQueue) Queue() workqueue.RateLimitingInterface
Queue returns the rate limit work queue
func (*SyncQueue) ResourceEventHandler ¶
func (sq *SyncQueue) ResourceEventHandler(scheme *runtime.Scheme) cache.ResourceEventHandler
func (*SyncQueue) SetMaxErrRetries ¶
SetMaxRetries sets the max retry times of the queue