Pull controller-go back into this repository as internal/controllerlib.

Signed-off-by: Matt Moyer <moyerm@vmware.com>
This commit is contained in:
Matt Moyer
2020-08-28 10:59:09 -05:00
parent 371b172616
commit a503fa8673
35 changed files with 1700 additions and 147 deletions

View File

@@ -0,0 +1,41 @@
/*
Copyright 2020 VMware, Inc.
SPDX-License-Identifier: Apache-2.0
*/
package controllerlib
import (
"time"
"k8s.io/client-go/util/workqueue"
)
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)
}
var _ Queue = &queueWrapper{}
type queueWrapper struct {
queue workqueue.RateLimitingInterface
}
func (q *queueWrapper) Add(key Key) {
q.queue.Add(key)
}
func (q *queueWrapper) AddRateLimited(key Key) {
q.queue.AddRateLimited(key)
}
func (q *queueWrapper) AddAfter(key Key, duration time.Duration) {
q.queue.AddAfter(key, duration)
}