This is an automated email from the ASF dual-hosted git repository.

lburgazzoli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 980baca145d7169853c1247472b2cb39ee110a72
Author: nferraro <ni.ferr...@gmail.com>
AuthorDate: Fri Oct 26 23:37:35 2018 +0200

    use a shorter refresh period in the CLI
---
 Gopkg.lock                                                     |  7 ++++---
 Gopkg.toml                                                     | 10 +++++-----
 pkg/client/cmd/root.go                                         |  8 ++++++--
 .../operator-framework/operator-sdk/pkg/k8sclient/client.go    |  8 +++++++-
 4 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/Gopkg.lock b/Gopkg.lock
index d82a832..b96c088 100644
--- a/Gopkg.lock
+++ b/Gopkg.lock
@@ -278,7 +278,8 @@
   version = "v3.9.0"
 
 [[projects]]
-  digest = "1:ce6ed8da0816d327c1d586722a13c05a3fd26cf9b8649cdcda300c16f026feca"
+  branch = "v0.0.7-custom"
+  digest = "1:8f0bbe43f11ba62deaae454383b93f9b8b58a1e4b68f9b39ee93f4a9633ec52a"
   name = "github.com/operator-framework/operator-sdk"
   packages = [
     "pkg/k8sclient",
@@ -288,8 +289,8 @@
     "version",
   ]
   pruneopts = "NUT"
-  revision = "e5a0ab096e1a7c0e6b937d2b41707eccb82c3c77"
-  version = "v0.0.7"
+  revision = "450f0742059bb08f2f0c041154435e340a7829a2"
+  source = "https://github.com/nicolaferraro/operator-sdk.git";
 
 [[projects]]
   branch = "master"
diff --git a/Gopkg.toml b/Gopkg.toml
index 4102eb3..c627513 100644
--- a/Gopkg.toml
+++ b/Gopkg.toml
@@ -48,9 +48,9 @@ required = [
 
 [[constraint]]
   name = "github.com/operator-framework/operator-sdk"
-  ## Using fork to customize the Kubernetes rest config
-  #source = "https://github.com/nicolaferraro/operator-sdk.git";
-  #branch = "custom-init"
-  # The version rule is used for a specific release and the master branch for 
in between releases.
+  # Using fork to customize the Kubernetes rest config
+  source = "https://github.com/nicolaferraro/operator-sdk.git";
+  branch = "v0.0.7-custom"
+  ## The version rule is used for a specific release and the master branch for 
in between releases.
   #branch = "master"
-  version = "=v0.0.7"
+  #version = "=v0.0.7"
diff --git a/pkg/client/cmd/root.go b/pkg/client/cmd/root.go
index 69920e7..58cc58a 100644
--- a/pkg/client/cmd/root.go
+++ b/pkg/client/cmd/root.go
@@ -18,9 +18,10 @@ limitations under the License.
 package cmd
 
 import (
-       "os"
-
        "context"
+       "github.com/operator-framework/operator-sdk/pkg/k8sclient"
+       "os"
+       "time"
 
        "github.com/apache/camel-k/pkg/util/kubernetes"
        "github.com/pkg/errors"
@@ -66,6 +67,9 @@ func NewKamelCommand(ctx context.Context) (*cobra.Command, 
error) {
                cmd.Flag("namespace").Value.Set(current)
        }
 
+       // Let's use a fast refresh period when running with the CLI
+       k8sclient.ResetCacheEvery(2 * time.Second)
+
        // Initialize the Kubernetes client to allow using the operator-sdk
        err := kubernetes.InitKubeClient(options.KubeConfig)
        if err != nil {
diff --git 
a/vendor/github.com/operator-framework/operator-sdk/pkg/k8sclient/client.go 
b/vendor/github.com/operator-framework/operator-sdk/pkg/k8sclient/client.go
index 466bd3b..d9f9b0b 100644
--- a/vendor/github.com/operator-framework/operator-sdk/pkg/k8sclient/client.go
+++ b/vendor/github.com/operator-framework/operator-sdk/pkg/k8sclient/client.go
@@ -43,6 +43,7 @@ var (
        // this stores the singleton in a package local
        singletonFactory *resourceClientFactory
        once             sync.Once
+       cacheResetPeriod = 1 * time.Minute
 )
 
 // Private constructor for once.Do
@@ -63,7 +64,7 @@ func newSingletonFactory() {
                dynamicClient: dynamicClient,
                restMapper:    restMapper,
        }
-       singletonFactory.runBackgroundCacheReset(1 * time.Minute)
+       singletonFactory.runBackgroundCacheReset(cacheResetPeriod)
 }
 
 // GetResourceClient returns the resource client using a singleton factory
@@ -106,6 +107,11 @@ func (c *resourceClientFactory) 
GetResourceClient(apiVersion, kind, namespace st
        return resourceClient, pluralName, nil
 }
 
+// ResetCacheEvery sets the period of refresh of the client caches
+func ResetCacheEvery(duration time.Duration) {
+       cacheResetPeriod = duration
+}
+
 // apiResource consults the REST mapper to translate an <apiVersion, kind, 
namespace> tuple to a GroupVersionResource
 func gvkToGVR(gvk schema.GroupVersionKind, restMapper 
*restmapper.DeferredDiscoveryRESTMapper) (*schema.GroupVersionResource, error) {
        mapping, err := restMapper.RESTMapping(gvk.GroupKind(), gvk.Version)

Reply via email to