Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller interface { // Enqueue generates the key of 'obj' according to a 'KeyFunc' then adds the 'item' to queue immediately. Enqueue(obj interface{}) // Run starts a certain number of concurrent workers to reconcile the items and will never stop until // the context is closed or canceled Run(ctx context.Context, workerNumber int) error }
Controller maintains a rate limiting queue and the items in the queue will be reconciled by a "ReconcileFunc". The item will be re-queued if "ReconcileFunc" returns an error, maximum re-queue times defined by "maxRetries" above, after that the item will be discarded from the queue.
func NewController ¶
func NewController(Name string, KeyFunc KeyFunc, ReconcileFunc ReconcileFunc, rateLimiter workqueue.RateLimiter) Controller
NewController returns a controller which can process resource periodically. We create the queue during the creation of the controller which means it can only be run once. We can move that to the run if we need to run it multiple times
type KeyFunc ¶
KeyFunc knows how to make a key from an object. Implementations should be deterministic.
type QueueKey ¶
type QueueKey interface{}
QueueKey is the type of the item key that stores in queue. The key could be arbitrary types.
The most common full-qualified key is of type '<namespace>/<name>' which doesn't carry the `GVK` info of the resource the key points to. We need to support a key type that includes GVK(Group Version Kind) so that we can reconcile on any type of resources.
func ClusterWideKeyFunc ¶
ClusterWideKeyFunc generates a ClusterWideKey for object.
func NamespaceKeyFunc ¶
NamespaceKeyFunc generates a namespaced key for any objects.