Merge pull request #4749 from derekwaynecarr/make_quota_more_efficient

Make admission control plug-ins work from indexes
This commit is contained in:
Eric Tune
2015-03-06 14:11:12 -08:00
13 changed files with 148 additions and 19 deletions

View File

@@ -53,6 +53,14 @@ type Reflector struct {
resyncPeriod time.Duration
}
// NewNamespaceKeyedIndexerAndReflector creates an Indexer and a Reflector
// The indexer is configured to key on namespace
func NewNamespaceKeyedIndexerAndReflector(lw ListerWatcher, expectedType interface{}, resyncPeriod time.Duration) (indexer Indexer, reflector *Reflector) {
indexer = NewIndexer(MetaNamespaceKeyFunc, Indexers{"namespace": MetaNamespaceIndexFunc})
reflector = NewReflector(lw, expectedType, indexer, resyncPeriod)
return indexer, reflector
}
// NewReflector creates a new Reflector object which will keep the given store up to
// date with the server's contents for the given resource. Reflector promises to
// only put things in the store that have the type of expectedType.