From 0b783752117912a6f1aa89b5bbeaa7b8c24de3c2 Mon Sep 17 00:00:00 2001 From: Yves Peter Date: Sun, 13 Nov 2016 22:11:58 +0100 Subject: [PATCH] Kubernetes client: set resync period to 5 minutes for more robustness --- provider/k8s/client.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/provider/k8s/client.go b/provider/k8s/client.go index 400677db0..71267a9f9 100644 --- a/provider/k8s/client.go +++ b/provider/k8s/client.go @@ -1,6 +1,8 @@ package k8s import ( + "time" + "k8s.io/client-go/1.5/kubernetes" "k8s.io/client-go/1.5/pkg/api" "k8s.io/client-go/1.5/pkg/api/v1" @@ -13,6 +15,8 @@ import ( "k8s.io/client-go/1.5/tools/cache" ) +const resyncPeriod = time.Minute * 5 + // Client is a client for the Kubernetes master. type Client interface { GetIngresses(namespaces Namespaces) []*v1beta1.Ingress @@ -99,7 +103,7 @@ func (c *clientImpl) WatchIngresses(labelSelector labels.Selector, stopCh <-chan c.ingStore, c.ingController = cache.NewInformer( source, &v1beta1.Ingress{}, - 0, + resyncPeriod, newResourceEventHandlerFuncs(watchCh)) go c.ingController.Run(stopCh) @@ -140,7 +144,7 @@ func (c *clientImpl) WatchServices(stopCh <-chan struct{}) chan interface{} { c.svcStore, c.svcController = cache.NewInformer( source, &v1.Service{}, - 0, + resyncPeriod, newResourceEventHandlerFuncs(watchCh)) go c.svcController.Run(stopCh) @@ -173,7 +177,7 @@ func (c *clientImpl) WatchEndpoints(stopCh <-chan struct{}) chan interface{} { c.epStore, c.epController = cache.NewInformer( source, &v1.Endpoints{}, - 0, + resyncPeriod, newResourceEventHandlerFuncs(watchCh)) go c.epController.Run(stopCh)