mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-16 14:45:28 +00:00
Make list watch take a ListFunc and WatchFunc, provide default funcs from client
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
|
@@ -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}
|
||||
|
||||
|
Reference in New Issue
Block a user