Merge pull request #4453 from derekwaynecarr/make_quota_more_efficient

Make ListWatch work with a ListFunc and WatchFunc
This commit is contained in:
Clayton Coleman
2015-02-17 14:48:11 -05:00
7 changed files with 94 additions and 104 deletions

View File

@@ -28,11 +28,7 @@ import (
// NewSourceApiserver creates a config source that watches and pulls from the apiserver.
func NewSourceApiserver(client *client.Client, hostname string, updates chan<- interface{}) {
lw := &cache.ListWatch{
Client: client,
FieldSelector: labels.OneTermEqualSelector("Status.Host", hostname),
Resource: "pods",
}
lw := cache.NewListWatchFromClient(client, "pods", api.NamespaceAll, labels.OneTermEqualSelector("Status.Host", hostname))
newSourceApiserverFromLW(lw, updates)
}

View File

@@ -95,7 +95,7 @@ func NewMainKubelet(
serviceStore := cache.NewStore(cache.MetaNamespaceKeyFunc)
if kubeClient != nil {
cache.NewReflector(&cache.ListWatch{kubeClient, labels.Everything(), "services", api.NamespaceAll}, &api.Service{}, serviceStore).Run()
cache.NewReflector(cache.NewListWatchFromClient(kubeClient, "services", api.NamespaceAll, labels.Everything()), &api.Service{}, serviceStore).Run()
}
serviceLister := &cache.StoreToServiceLister{serviceStore}