You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2018/12/14 08:52:39 UTC

[camel-k] 01/08: chore(dev) make dev mode 10x faster on remote clusters by caching client

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

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

commit f6e03b36f35a1347ca25fcfc668e857a301c6271
Author: nferraro <ni...@gmail.com>
AuthorDate: Wed Dec 12 01:14:57 2018 +0100

    chore(dev) make dev mode 10x faster on remote clusters by caching client
---
 pkg/client/cmd/install.go | 5 +++++
 pkg/client/cmd/root.go    | 7 -------
 pkg/install/operator.go   | 2 +-
 3 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/pkg/client/cmd/install.go b/pkg/client/cmd/install.go
index 5b86a8b..2bafe94 100644
--- a/pkg/client/cmd/install.go
+++ b/pkg/client/cmd/install.go
@@ -19,6 +19,8 @@ package cmd
 
 import (
 	"fmt"
+	"github.com/operator-framework/operator-sdk/pkg/k8sclient"
+	"time"
 
 	"github.com/apache/camel-k/pkg/install"
 	"github.com/pkg/errors"
@@ -56,6 +58,9 @@ type installCmdOptions struct {
 }
 
 func (o *installCmdOptions) install(cmd *cobra.Command, args []string) error {
+	// Let's use a fast refresh period when running with the CLI
+	k8sclient.ResetCacheEvery(8 * time.Second)
+
 	err := install.SetupClusterwideResources()
 	if err != nil && k8serrors.IsForbidden(err) {
 		fmt.Println("Current user is not authorized to create cluster-wide objects like custom resource definitions or cluster roles: ", err)
diff --git a/pkg/client/cmd/root.go b/pkg/client/cmd/root.go
index c69f063..ed02838 100644
--- a/pkg/client/cmd/root.go
+++ b/pkg/client/cmd/root.go
@@ -19,10 +19,6 @@ package cmd
 
 import (
 	"context"
-	"time"
-
-	"github.com/operator-framework/operator-sdk/pkg/k8sclient"
-
 	"github.com/apache/camel-k/pkg/util/kubernetes"
 	"github.com/pkg/errors"
 	"github.com/spf13/cobra"
@@ -63,9 +59,6 @@ func NewKamelCommand(ctx context.Context) (*cobra.Command, error) {
 				}
 			}
 
-			// 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
 			return kubernetes.InitKubeClient(options.KubeConfig)
 		},
diff --git a/pkg/install/operator.go b/pkg/install/operator.go
index 3af6a0e..147bbb5 100644
--- a/pkg/install/operator.go
+++ b/pkg/install/operator.go
@@ -87,7 +87,7 @@ func installKnative(namespace string) error {
 
 // Platform installs the platform custom resource
 func Platform(namespace string, registry string, organization string, pushSecret string) error {
-	if err := waitForPlatformCRDAvailable(namespace, 15*time.Second); err != nil {
+	if err := waitForPlatformCRDAvailable(namespace, 25*time.Second); err != nil {
 		return err
 	}
 	isOpenshift, err := openshift.IsOpenShift()