diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 18d630f4..848d4e71 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -288,7 +288,7 @@ }, { "ImportPath": "k8s.io/apimachinery", - "Rev": "e31a5531b558" + "Rev": "f378a67c6af3" }, { "ImportPath": "k8s.io/gengo", diff --git a/examples/workqueue/main.go b/examples/workqueue/main.go index c306aaae..6cfa4ecd 100644 --- a/examples/workqueue/main.go +++ b/examples/workqueue/main.go @@ -23,7 +23,7 @@ import ( "k8s.io/klog" - "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/fields" "k8s.io/apimachinery/pkg/util/runtime" diff --git a/go.mod b/go.mod index afffe45c..98495fd7 100644 --- a/go.mod +++ b/go.mod @@ -27,7 +27,7 @@ require ( golang.org/x/time v0.0.0-20161028155119-f51c12702a4d google.golang.org/appengine v1.5.0 // indirect k8s.io/api v0.0.0-20190826194732-9f642ccb7a30 - k8s.io/apimachinery v0.0.0-20190826114657-e31a5531b558 + k8s.io/apimachinery v0.0.0-20190827074644-f378a67c6af3 k8s.io/klog v0.4.0 k8s.io/utils v0.0.0-20190801114015-581e00157fb1 sigs.k8s.io/yaml v1.1.0 @@ -39,5 +39,5 @@ replace ( golang.org/x/sys => golang.org/x/sys v0.0.0-20190209173611-3b5209105503 golang.org/x/text => golang.org/x/text v0.3.1-0.20181227161524-e6919f6577db k8s.io/api => k8s.io/api v0.0.0-20190826194732-9f642ccb7a30 - k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20190826114657-e31a5531b558 + k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20190827074644-f378a67c6af3 ) diff --git a/go.sum b/go.sum index e577f081..971fdf1d 100644 --- a/go.sum +++ b/go.sum @@ -145,7 +145,7 @@ gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= k8s.io/api v0.0.0-20190826194732-9f642ccb7a30/go.mod h1:wKwR91YLONtsDxeJMXqvshPVeRU6ek8/1MfKoDBFqU0= -k8s.io/apimachinery v0.0.0-20190826114657-e31a5531b558/go.mod h1:EZoIMuAgG/4v58YL+bz0kqnivqupk28fKYxFCa5e6X8= +k8s.io/apimachinery v0.0.0-20190827074644-f378a67c6af3/go.mod h1:EZoIMuAgG/4v58YL+bz0kqnivqupk28fKYxFCa5e6X8= k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= diff --git a/tools/cache/shared_informer.go b/tools/cache/shared_informer.go index 351c85b9..c37423b6 100644 --- a/tools/cache/shared_informer.go +++ b/tools/cache/shared_informer.go @@ -190,8 +190,24 @@ const ( initialBufferSize = 1024 ) +// WaitForNamedCacheSync is a wrapper around WaitForCacheSync that generates log messages +// indicating that the caller identified by name is waiting for syncs, followed by +// either a successful or failed sync. +func WaitForNamedCacheSync(controllerName string, stopCh <-chan struct{}, cacheSyncs ...InformerSynced) bool { + klog.Infof("Waiting for caches to sync for %s", controllerName) + + if !WaitForCacheSync(stopCh, cacheSyncs...) { + utilruntime.HandleError(fmt.Errorf("unable to sync caches for %s", controllerName)) + return false + } + + klog.Infof("Caches are synced for %s ", controllerName) + return true +} + // WaitForCacheSync waits for caches to populate. It returns true if it was successful, false // if the controller should shutdown +// callers should prefer WaitForNamedCacheSync() func WaitForCacheSync(stopCh <-chan struct{}, cacheSyncs ...InformerSynced) bool { err := wait.PollUntil(syncedPollPeriod, func() (bool, error) {