Skip to content

Commit

Permalink
Merge pull request kubernetes-retired#781 from mwielgus/relists-in-watch
Browse files Browse the repository at this point in the history
Refresh pods and nodes every 1 hour
  • Loading branch information
piosz committed Dec 11, 2015
2 parents 6a743e0 + a3f2c4a commit b9ab6fe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion sources/nodes/kube.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"fmt"
"net"
"sync"
"time"

"github.com/golang/glog"
api "k8s.io/kubernetes/pkg/api"
Expand Down Expand Up @@ -153,7 +154,7 @@ func NewKubeNodes(client *client.Client) (NodesApi, error) {

lw := cache.NewListWatchFromClient(client, "nodes", api.NamespaceAll, fields.Everything())
nodeLister := &cache.StoreToNodeLister{Store: cache.NewStore(cache.MetaNamespaceKeyFunc)}
reflector := cache.NewReflector(lw, &api.Node{}, nodeLister.Store, 0)
reflector := cache.NewReflector(lw, &api.Node{}, nodeLister.Store, time.Hour)
stopChan := make(chan struct{})
reflector.RunUntil(stopChan)

Expand Down
2 changes: 1 addition & 1 deletion sources/pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func newPodsApi(client *kclient.Client) podsApi {
lw := kcache.NewListWatchFromClient(client, "pods", kapi.NamespaceAll, selector)
podLister := &kcache.StoreToPodLister{Store: kcache.NewStore(kcache.MetaNamespaceKeyFunc)}
// Watch and cache all running pods.
reflector := kcache.NewReflector(lw, &kapi.Pod{}, podLister.Store, 0)
reflector := kcache.NewReflector(lw, &kapi.Pod{}, podLister.Store, time.Hour)
stopChan := make(chan struct{})
reflector.RunUntil(stopChan)
nStore, nController := kframework.NewInformer(
Expand Down

0 comments on commit b9ab6fe

Please sign in to comment.