Add poll interval global variable

pull/10/head
stefanprodan 5 years ago
parent 6d66f42382
commit 1e03155e8b

@ -161,7 +161,7 @@ func createKsCmdRun(cmd *cobra.Command, args []string) error {
} }
logWaiting("waiting for kustomization sync") logWaiting("waiting for kustomization sync")
if err := wait.PollImmediate(2*time.Second, timeout, if err := wait.PollImmediate(pollInterval, timeout,
isKustomizationReady(ctx, kubeClient, name, namespace)); err != nil { isKustomizationReady(ctx, kubeClient, name, namespace)); err != nil {
return err return err
} }

@ -3,21 +3,19 @@ package main
import ( import (
"context" "context"
"fmt" "fmt"
"io/ioutil"
"net/url"
"os"
"strings"
"time"
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1" sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
"github.com/manifoldco/promptui" "github.com/manifoldco/promptui"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"io/ioutil"
corev1 "k8s.io/api/core/v1" corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/wait" "k8s.io/apimachinery/pkg/util/wait"
"net/url"
"os"
"sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client"
"strings"
) )
var createSourceGitCmd = &cobra.Command{ var createSourceGitCmd = &cobra.Command{
@ -158,7 +156,7 @@ func createSourceGitCmdRun(cmd *cobra.Command, args []string) error {
} }
logWaiting("waiting for git sync") logWaiting("waiting for git sync")
if err := wait.PollImmediate(2*time.Second, timeout, if err := wait.PollImmediate(pollInterval, timeout,
isGitRepositoryReady(ctx, kubeClient, name, namespace)); err != nil { isGitRepositoryReady(ctx, kubeClient, name, namespace)); err != nil {
return err return err
} }

@ -56,6 +56,7 @@ var (
verbose bool verbose bool
components []string components []string
utils Utils utils Utils
pollInterval = 2 * time.Second
) )
func init() { func init() {

@ -82,7 +82,7 @@ func syncKsCmdRun(cmd *cobra.Command, args []string) error {
} }
logWaiting("waiting for kustomization sync") logWaiting("waiting for kustomization sync")
if err := wait.PollImmediate(2*time.Second, timeout, if err := wait.PollImmediate(pollInterval, timeout,
isKustomizationReady(ctx, kubeClient, name, namespace)); err != nil { isKustomizationReady(ctx, kubeClient, name, namespace)); err != nil {
return err return err
} }

@ -64,7 +64,7 @@ func syncSourceGitCmdRun(cmd *cobra.Command, args []string) error {
logSuccess("source annotated") logSuccess("source annotated")
logWaiting("waiting for git sync") logWaiting("waiting for git sync")
if err := wait.PollImmediate(2*time.Second, timeout, if err := wait.PollImmediate(pollInterval, timeout,
isGitRepositoryReady(ctx, kubeClient, name, namespace)); err != nil { isGitRepositoryReady(ctx, kubeClient, name, namespace)); err != nil {
return err return err
} }

Loading…
Cancel
Save