Skip to content

Commit

Permalink
chore(dev) make dev mode 10x faster on remote clusters by caching client
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaferraro committed Dec 14, 2018
1 parent 6a8c149 commit f6e03b3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
5 changes: 5 additions & 0 deletions pkg/client/cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down
7 changes: 0 additions & 7 deletions pkg/client/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
},
Expand Down
2 changes: 1 addition & 1 deletion pkg/install/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit f6e03b3

Please sign in to comment.