refactor: upgrade gitops-engine version ( breaking API changes related to logr mirgation ) (#4652)

This commit is contained in:
Alexander Matyushentsev 2020-10-27 14:10:24 -07:00 committed by GitHub
parent 764ea07fc0
commit a96b476f16
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
94 changed files with 325 additions and 150 deletions

View file

@ -7,8 +7,6 @@ import (
"os"
"time"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
"github.com/argoproj/gitops-engine/pkg/utils/kube"
"github.com/argoproj/pkg/stats"
"github.com/go-redis/redis/v8"
log "github.com/sirupsen/logrus"
@ -33,6 +31,8 @@ import (
appstatecache "github.com/argoproj/argo-cd/util/cache/appstate"
"github.com/argoproj/argo-cd/util/cli"
"github.com/argoproj/argo-cd/util/env"
"github.com/argoproj/argo-cd/util/errors"
kubeutil "github.com/argoproj/argo-cd/util/kube"
"github.com/argoproj/argo-cd/util/settings"
)
@ -87,7 +87,7 @@ func newCommand() *cobra.Command {
errors.CheckError(err)
settingsMgr := settings.NewSettingsManager(ctx, kubeClient, namespace)
kubectl := &kube.KubectlCmd{}
kubectl := kubeutil.NewKubectl()
clusterFilter := getClusterFilter()
appController, err := controller.NewApplicationController(
namespace,

View file

@ -8,7 +8,6 @@ import (
"os"
"time"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
"github.com/argoproj/pkg/stats"
"github.com/go-redis/redis/v8"
log "github.com/sirupsen/logrus"
@ -22,6 +21,7 @@ import (
cacheutil "github.com/argoproj/argo-cd/util/cache"
"github.com/argoproj/argo-cd/util/cli"
"github.com/argoproj/argo-cd/util/env"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/gpg"
"github.com/argoproj/argo-cd/util/tls"
)

View file

@ -4,15 +4,13 @@ import (
"context"
"time"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
"github.com/argoproj/pkg/stats"
"github.com/go-redis/redis/v8"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientcmd"
log "github.com/sirupsen/logrus"
"github.com/argoproj/argo-cd/common"
"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
appclientset "github.com/argoproj/argo-cd/pkg/client/clientset/versioned"
@ -21,6 +19,7 @@ import (
servercache "github.com/argoproj/argo-cd/server/cache"
"github.com/argoproj/argo-cd/util/cli"
"github.com/argoproj/argo-cd/util/env"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/kube"
"github.com/argoproj/argo-cd/util/tls"
)

View file

@ -1,9 +1,8 @@
package main
import (
"github.com/argoproj/gitops-engine/pkg/utils/errors"
commands "github.com/argoproj/argo-cd/cmd/argocd-server/commands"
"github.com/argoproj/argo-cd/util/errors"
// load the gcp plugin (required to authenticate against GKE clusters).
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"

View file

@ -9,8 +9,6 @@ import (
"sort"
"time"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
"github.com/argoproj/gitops-engine/pkg/utils/kube"
"github.com/ghodss/yaml"
"github.com/spf13/cobra"
apiv1 "k8s.io/api/core/v1"
@ -32,6 +30,7 @@ import (
"github.com/argoproj/argo-cd/util/cli"
"github.com/argoproj/argo-cd/util/config"
"github.com/argoproj/argo-cd/util/db"
"github.com/argoproj/argo-cd/util/errors"
kubeutil "github.com/argoproj/argo-cd/util/kube"
"github.com/argoproj/argo-cd/util/settings"
)
@ -291,7 +290,7 @@ func reconcileApplications(
}
appStateManager := controller.NewAppStateManager(
argoDB, appClientset, repoServerClient, namespace, &kube.KubectlCmd{}, settingsMgr, stateCache, projInformer, server)
argoDB, appClientset, repoServerClient, namespace, kubeutil.NewKubectl(), settingsMgr, stateCache, projInformer, server)
appsList, err := appClientset.ArgoprojV1alpha1().Applications(namespace).List(context.Background(), v1.ListOptions{LabelSelector: selector})
if err != nil {
@ -333,5 +332,5 @@ func reconcileApplications(
}
func newLiveStateCache(argoDB db.ArgoDB, appInformer kubecache.SharedIndexInformer, settingsMgr *settings.SettingsManager, server *metrics.MetricsServer) cache.LiveStateCache {
return cache.NewLiveStateCache(argoDB, appInformer, settingsMgr, &kube.KubectlCmd{}, server, func(managedByApp map[string]bool, ref apiv1.ObjectReference) {}, nil)
return cache.NewLiveStateCache(argoDB, appInformer, settingsMgr, kubeutil.NewKubectl(), server, func(managedByApp map[string]bool, ref apiv1.ObjectReference) {}, nil)
}

View file

@ -11,8 +11,8 @@ import (
appclientset "github.com/argoproj/argo-cd/pkg/client/clientset/versioned"
appclient "github.com/argoproj/argo-cd/pkg/client/clientset/versioned/typed/application/v1alpha1"
"github.com/argoproj/argo-cd/util/cli"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
"github.com/argoproj/gitops-engine/pkg/utils/kube"
"github.com/spf13/cobra"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"

View file

@ -13,7 +13,6 @@ import (
"text/tabwriter"
healthutil "github.com/argoproj/gitops-engine/pkg/health"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
"github.com/ghodss/yaml"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
@ -28,6 +27,7 @@ import (
"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/util/argo/normalizers"
"github.com/argoproj/argo-cd/util/cli"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/lua"
"github.com/argoproj/argo-cd/util/settings"
)

View file

@ -10,9 +10,9 @@ import (
"testing"
"github.com/argoproj/argo-cd/common"
utils "github.com/argoproj/argo-cd/util/io"
"github.com/argoproj/argo-cd/util/settings"
utils "github.com/argoproj/gitops-engine/pkg/utils/io"
"github.com/stretchr/testify/assert"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

View file

@ -11,7 +11,6 @@ import (
"reflect"
"syscall"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
"github.com/argoproj/gitops-engine/pkg/utils/kube"
"github.com/ghodss/yaml"
log "github.com/sirupsen/logrus"
@ -31,6 +30,7 @@ import (
"github.com/argoproj/argo-cd/util/cli"
"github.com/argoproj/argo-cd/util/db"
"github.com/argoproj/argo-cd/util/dex"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/settings"
// load the gcp plugin (required to authenticate against GKE clusters).

View file

@ -10,8 +10,6 @@ import (
"text/tabwriter"
"time"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
"github.com/argoproj/gitops-engine/pkg/utils/io"
timeutil "github.com/argoproj/pkg/time"
"github.com/ghodss/yaml"
log "github.com/sirupsen/logrus"
@ -23,6 +21,8 @@ import (
"github.com/argoproj/argo-cd/pkg/apiclient/session"
"github.com/argoproj/argo-cd/server/rbacpolicy"
"github.com/argoproj/argo-cd/util/cli"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/io"
"github.com/argoproj/argo-cd/util/localconfig"
sessionutil "github.com/argoproj/argo-cd/util/session"
)

View file

@ -20,8 +20,6 @@ import (
"github.com/argoproj/gitops-engine/pkg/health"
"github.com/argoproj/gitops-engine/pkg/sync/hook"
"github.com/argoproj/gitops-engine/pkg/sync/ignore"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
argoio "github.com/argoproj/gitops-engine/pkg/utils/io"
"github.com/argoproj/gitops-engine/pkg/utils/kube"
"github.com/ghodss/yaml"
log "github.com/sirupsen/logrus"
@ -49,7 +47,9 @@ import (
"github.com/argoproj/argo-cd/util/argo"
"github.com/argoproj/argo-cd/util/cli"
"github.com/argoproj/argo-cd/util/config"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/git"
argoio "github.com/argoproj/argo-cd/util/io"
argokube "github.com/argoproj/argo-cd/util/kube"
"github.com/argoproj/argo-cd/util/templates"
"github.com/argoproj/argo-cd/util/text/label"
@ -1140,7 +1140,7 @@ func NewApplicationDiffCommand(clientOpts *argocdclient.ClientOptions) *cobra.Co
normalizer, err := argo.NewDiffNormalizer(app.Spec.IgnoreDifferences, overrides)
errors.CheckError(err)
diffRes, err := diff.Diff(item.target, item.live, normalizer, diff.GetDefaultDiffOptions())
diffRes, err := diff.Diff(item.target, item.live, diff.WithNormalizer(normalizer))
errors.CheckError(err)
if diffRes.Modified || item.target == nil || item.live == nil {

View file

@ -8,14 +8,14 @@ import (
"strconv"
"text/tabwriter"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
"github.com/argoproj/gitops-engine/pkg/utils/io"
"github.com/ghodss/yaml"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
argocdclient "github.com/argoproj/argo-cd/pkg/apiclient"
applicationpkg "github.com/argoproj/argo-cd/pkg/apiclient/application"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/io"
)
type DisplayedAction struct {

View file

@ -9,14 +9,14 @@ import (
"strings"
"text/tabwriter"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
"github.com/argoproj/gitops-engine/pkg/utils/io"
"github.com/spf13/cobra"
argocdclient "github.com/argoproj/argo-cd/pkg/apiclient"
certificatepkg "github.com/argoproj/argo-cd/pkg/apiclient/certificate"
appsv1 "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
certutil "github.com/argoproj/argo-cd/util/cert"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/io"
)
// NewCertCommand returns a new instance of an `argocd repo` command

View file

@ -9,8 +9,6 @@ import (
"strings"
"text/tabwriter"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
"github.com/argoproj/gitops-engine/pkg/utils/io"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"k8s.io/client-go/kubernetes"
@ -22,6 +20,8 @@ import (
clusterpkg "github.com/argoproj/argo-cd/pkg/apiclient/cluster"
argoappv1 "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/util/clusterauth"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/io"
)
// NewClusterCommand returns a new instance of an `argocd cluster` command

View file

@ -8,11 +8,11 @@ import (
"strings"
"text/tabwriter"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
argocdclient "github.com/argoproj/argo-cd/pkg/apiclient"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/localconfig"
)

View file

@ -8,13 +8,13 @@ import (
"strings"
"text/tabwriter"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
argoio "github.com/argoproj/gitops-engine/pkg/utils/io"
"github.com/spf13/cobra"
argocdclient "github.com/argoproj/argo-cd/pkg/apiclient"
gpgkeypkg "github.com/argoproj/argo-cd/pkg/apiclient/gpgkey"
appsv1 "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/util/errors"
argoio "github.com/argoproj/argo-cd/util/io"
)
// NewGPGCommand returns a new instance of an `argocd repo` command

View file

@ -11,8 +11,6 @@ import (
"strings"
"time"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
"github.com/argoproj/gitops-engine/pkg/utils/io"
"github.com/coreos/go-oidc"
"github.com/dgrijalva/jwt-go"
log "github.com/sirupsen/logrus"
@ -24,7 +22,9 @@ import (
sessionpkg "github.com/argoproj/argo-cd/pkg/apiclient/session"
settingspkg "github.com/argoproj/argo-cd/pkg/apiclient/settings"
"github.com/argoproj/argo-cd/util/cli"
"github.com/argoproj/argo-cd/util/errors"
grpc_util "github.com/argoproj/argo-cd/util/grpc"
"github.com/argoproj/argo-cd/util/io"
"github.com/argoproj/argo-cd/util/localconfig"
oidcutil "github.com/argoproj/argo-cd/util/oidc"
"github.com/argoproj/argo-cd/util/rand"

View file

@ -4,11 +4,11 @@ import (
"fmt"
"os"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
argocdclient "github.com/argoproj/argo-cd/pkg/apiclient"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/localconfig"
)

View file

@ -12,8 +12,6 @@ import (
"text/tabwriter"
"time"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
argoio "github.com/argoproj/gitops-engine/pkg/utils/io"
humanize "github.com/dustin/go-humanize"
"github.com/ghodss/yaml"
log "github.com/sirupsen/logrus"
@ -28,8 +26,10 @@ import (
"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/util/cli"
"github.com/argoproj/argo-cd/util/config"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/git"
"github.com/argoproj/argo-cd/util/gpg"
argoio "github.com/argoproj/argo-cd/util/io"
)
type projectOpts struct {

View file

@ -8,8 +8,6 @@ import (
"text/tabwriter"
"time"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
"github.com/argoproj/gitops-engine/pkg/utils/io"
timeutil "github.com/argoproj/pkg/time"
jwtgo "github.com/dgrijalva/jwt-go"
"github.com/spf13/cobra"
@ -17,6 +15,8 @@ import (
argocdclient "github.com/argoproj/argo-cd/pkg/apiclient"
projectpkg "github.com/argoproj/argo-cd/pkg/apiclient/project"
"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/io"
)
const (

View file

@ -8,13 +8,13 @@ import (
"strings"
"text/tabwriter"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
"github.com/argoproj/gitops-engine/pkg/utils/io"
"github.com/spf13/cobra"
argocdclient "github.com/argoproj/argo-cd/pkg/apiclient"
projectpkg "github.com/argoproj/argo-cd/pkg/apiclient/project"
"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/io"
)
// NewProjectWindowsCommand returns a new instance of the `argocd proj windows` command

View file

@ -5,14 +5,14 @@ import (
"fmt"
"os"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
argoio "github.com/argoproj/gitops-engine/pkg/utils/io"
"github.com/coreos/go-oidc"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
argocdclient "github.com/argoproj/argo-cd/pkg/apiclient"
settingspkg "github.com/argoproj/argo-cd/pkg/apiclient/settings"
"github.com/argoproj/argo-cd/util/errors"
argoio "github.com/argoproj/argo-cd/util/io"
"github.com/argoproj/argo-cd/util/localconfig"
"github.com/argoproj/argo-cd/util/session"
)

View file

@ -7,8 +7,6 @@ import (
"os"
"text/tabwriter"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
"github.com/argoproj/gitops-engine/pkg/utils/io"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
@ -17,7 +15,9 @@ import (
repositorypkg "github.com/argoproj/argo-cd/pkg/apiclient/repository"
appsv1 "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/util/cli"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/git"
"github.com/argoproj/argo-cd/util/io"
)
// NewRepoCommand returns a new instance of an `argocd repo` command

View file

@ -7,8 +7,6 @@ import (
"os"
"text/tabwriter"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
"github.com/argoproj/gitops-engine/pkg/utils/io"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
@ -16,7 +14,9 @@ import (
repocredspkg "github.com/argoproj/argo-cd/pkg/apiclient/repocreds"
appsv1 "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/util/cli"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/git"
"github.com/argoproj/argo-cd/util/io"
)
// NewRepoCredsCommand returns a new instance of an `argocd repocreds` command

View file

@ -1,13 +1,13 @@
package commands
import (
"github.com/argoproj/gitops-engine/pkg/utils/errors"
"github.com/spf13/cobra"
"k8s.io/client-go/tools/clientcmd"
argocdclient "github.com/argoproj/argo-cd/pkg/apiclient"
"github.com/argoproj/argo-cd/util/cli"
"github.com/argoproj/argo-cd/util/config"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/localconfig"
)

View file

@ -8,12 +8,11 @@ import (
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
argoio "github.com/argoproj/gitops-engine/pkg/utils/io"
"github.com/argoproj/argo-cd/common"
argocdclient "github.com/argoproj/argo-cd/pkg/apiclient"
"github.com/argoproj/argo-cd/pkg/apiclient/version"
"github.com/argoproj/argo-cd/util/errors"
argoio "github.com/argoproj/argo-cd/util/io"
)
// NewVersionCmd returns a new `version` command to be used as a sub-command to root

View file

@ -1,9 +1,8 @@
package main
import (
"github.com/argoproj/gitops-engine/pkg/utils/errors"
commands "github.com/argoproj/argo-cd/cmd/argocd/commands"
"github.com/argoproj/argo-cd/util/errors"
// load the gcp plugin (required to authenticate against GKE clusters).
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"

View file

@ -13,11 +13,11 @@ import (
"sync"
"time"
logutils "github.com/argoproj/argo-cd/util/log"
"github.com/argoproj/gitops-engine/pkg/diff"
"github.com/argoproj/gitops-engine/pkg/health"
synccommon "github.com/argoproj/gitops-engine/pkg/sync/common"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
"github.com/argoproj/gitops-engine/pkg/utils/io"
"github.com/argoproj/gitops-engine/pkg/utils/kube"
log "github.com/sirupsen/logrus"
"golang.org/x/sync/semaphore"
@ -49,6 +49,7 @@ import (
"github.com/argoproj/argo-cd/util/argo"
appstatecache "github.com/argoproj/argo-cd/util/cache/appstate"
"github.com/argoproj/argo-cd/util/db"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/glob"
settings_util "github.com/argoproj/argo-cd/util/settings"
)
@ -195,7 +196,7 @@ func (ctrl *ApplicationController) GetMetricsServer() *metrics.MetricsServer {
return ctrl.metricsServer
}
func (ctrl *ApplicationController) onKubectlRun(command string) (io.Closer, error) {
func (ctrl *ApplicationController) onKubectlRun(command string) (kube.CleanupFunc, error) {
ctrl.metricsServer.IncKubectlExec(command)
if ctrl.kubectlSemaphore != nil {
if err := ctrl.kubectlSemaphore.Acquire(context.Background(), 1); err != nil {
@ -203,13 +204,12 @@ func (ctrl *ApplicationController) onKubectlRun(command string) (io.Closer, erro
}
ctrl.metricsServer.IncKubectlExecPending(command)
}
return io.NewCloser(func() error {
return func() {
if ctrl.kubectlSemaphore != nil {
ctrl.kubectlSemaphore.Release(1)
ctrl.metricsServer.DecKubectlExecPending(command)
}
return nil
}), nil
}, nil
}
func isSelfReferencedApp(app *appv1.Application, ref v1.ObjectReference) bool {
@ -409,7 +409,10 @@ func (ctrl *ApplicationController) managedResources(comparisonResult *comparison
if err != nil {
return nil, err
}
resDiffPtr, err := diff.Diff(target, live, comparisonResult.diffNormalizer, compareOptions)
resDiffPtr, err := diff.Diff(target, live,
diff.WithNormalizer(comparisonResult.diffNormalizer),
diff.WithLogr(logutils.NewLogrusLogger(log.New())),
diff.IgnoreAggregatedRoles(compareOptions.IgnoreAggregatedRoles))
if err != nil {
return nil, err
}
@ -914,7 +917,7 @@ func (ctrl *ApplicationController) processRequestedAppOperation(app *appv1.Appli
}
func (ctrl *ApplicationController) setOperationState(app *appv1.Application, state *appv1.OperationState) {
kube.RetryUntilSucceed(context.Background(), updateOperationStateTimeout, "Update application operation state", func() error {
kube.RetryUntilSucceed(context.Background(), updateOperationStateTimeout, "Update application operation state", logutils.NewLogrusLogger(log.New()), func() error {
if state.Phase == "" {
// expose any bugs where we neglect to set phase
panic("no phase was set")

View file

@ -23,6 +23,7 @@ import (
appv1 "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/util/argo"
"github.com/argoproj/argo-cd/util/db"
logutils "github.com/argoproj/argo-cd/util/log"
"github.com/argoproj/argo-cd/util/lua"
"github.com/argoproj/argo-cd/util/settings"
)
@ -264,6 +265,7 @@ func (c *liveStateCache) getCluster(server string) (clustercache.ClusterCache, e
// want the full resource to be available in our cache (to diff), so we store all CRDs
return res, res.AppName != "" || un.GroupVersionKind().Kind == kube.CustomResourceDefinitionKind
}),
clustercache.SetLogr(logutils.NewLogrusLogger(log.WithField("server", cluster.Server))),
)
_ = clusterCache.OnResourceUpdated(func(newRes *clustercache.Resource, oldRes *clustercache.Resource, namespaceResources map[kube.ResourceKey]*clustercache.Resource) {
@ -434,7 +436,7 @@ func (c *liveStateCache) Init() error {
func (c *liveStateCache) Run(ctx context.Context) error {
go c.watchSettings(ctx)
kube.RetryUntilSucceed(ctx, clustercache.ClusterRetryTimeout, "watch clusters", func() error {
kube.RetryUntilSucceed(ctx, clustercache.ClusterRetryTimeout, "watch clusters", logutils.NewLogrusLogger(log.New()), func() error {
return c.db.WatchClusters(ctx, c.handleAddEvent, c.handleModEvent, c.handleDeleteEvent)
})

View file

@ -12,7 +12,6 @@ import (
hookutil "github.com/argoproj/gitops-engine/pkg/sync/hook"
"github.com/argoproj/gitops-engine/pkg/sync/ignore"
resourceutil "github.com/argoproj/gitops-engine/pkg/sync/resource"
"github.com/argoproj/gitops-engine/pkg/utils/io"
kubeutil "github.com/argoproj/gitops-engine/pkg/utils/kube"
log "github.com/sirupsen/logrus"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@ -32,6 +31,7 @@ import (
"github.com/argoproj/argo-cd/util/db"
"github.com/argoproj/argo-cd/util/gpg"
argohealth "github.com/argoproj/argo-cd/util/health"
"github.com/argoproj/argo-cd/util/io"
"github.com/argoproj/argo-cd/util/settings"
"github.com/argoproj/argo-cd/util/stats"
)
@ -426,12 +426,15 @@ func (m *appStateManager) CompareAppState(app *v1alpha1.Application, project *ap
compareOptions, err := m.settingsMgr.GetResourceCompareOptions()
if err != nil {
log.Warnf("Could not get compare options from ConfigMap (assuming defaults): %v", err)
compareOptions = diff.GetDefaultDiffOptions()
compareOptions = settings.GetDefaultDiffOptions()
}
logCtx.Debugf("built managed objects list")
// Do the actual comparison
diffResults, err := diff.DiffArray(reconciliation.Target, reconciliation.Live, diffNormalizer, compareOptions)
diffResults, err := diff.DiffArray(
reconciliation.Target, reconciliation.Live,
diff.WithNormalizer(diffNormalizer),
diff.IgnoreAggregatedRoles(compareOptions.IgnoreAggregatedRoles))
if err != nil {
diffResults = &diff.DiffResultList{}
failedToLoadObjs = true

View file

@ -19,6 +19,7 @@ import (
"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
listersv1alpha1 "github.com/argoproj/argo-cd/pkg/client/listers/application/v1alpha1"
"github.com/argoproj/argo-cd/util/argo"
logutils "github.com/argoproj/argo-cd/util/log"
"github.com/argoproj/argo-cd/util/lua"
"github.com/argoproj/argo-cd/util/rand"
)
@ -126,7 +127,14 @@ func (m *appStateManager) SyncAppState(app *v1alpha1.Application, state *v1alpha
Order: i + 1,
})
}
syncCtx, err := sync.NewSyncContext(compareResult.syncStatus.Revision, compareResult.reconciliationResult, restConfig, rawConfig, m.kubectl, app.Spec.Destination.Namespace, logEntry,
syncCtx, err := sync.NewSyncContext(
compareResult.syncStatus.Revision,
compareResult.reconciliationResult,
restConfig,
rawConfig,
m.kubectl,
app.Spec.Destination.Namespace,
sync.WithLogr(logutils.NewLogrusLogger(logEntry)),
sync.WithHealthOverride(lua.ResourceHealthOverrides(resourceOverrides)),
sync.WithPermissionValidator(func(un *unstructured.Unstructured, res *v1.APIResource) error {
if !proj.IsGroupKindPermitted(un.GroupVersionKind().GroupKind(), res.Namespaced) {

4
go.mod
View file

@ -7,8 +7,9 @@ require (
github.com/TomOnTime/utfutil v0.0.0-20180511104225-09c41003ee1d
github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6 // indirect
github.com/alicebob/miniredis v2.5.0+incompatible
github.com/argoproj/gitops-engine v0.1.3-0.20201014183719-4eb3ca3feefb
github.com/argoproj/gitops-engine v0.1.3-0.20201027001456-31311943a57a
github.com/argoproj/pkg v0.2.0
github.com/bombsimon/logrusr v0.0.0-20200131103305-03a291ce59b4
github.com/casbin/casbin v1.9.1
github.com/chai2010/gettext-go v0.0.0-20170215093142-bf70f2a70fb1 // indirect
github.com/coreos/go-oidc v2.1.0+incompatible
@ -18,6 +19,7 @@ require (
github.com/evanphx/json-patch v4.9.0+incompatible
github.com/fsnotify/fsnotify v1.4.9
github.com/ghodss/yaml v1.0.0
github.com/go-logr/logr v0.2.1
github.com/go-openapi/loads v0.19.4
github.com/go-openapi/runtime v0.19.4
github.com/go-openapi/spec v0.19.3

10
go.sum
View file

@ -84,8 +84,8 @@ github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo4JG6LR5AXSUEsOjtdm0kw0FtQtMJA=
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q=
github.com/argoproj/gitops-engine v0.1.3-0.20201014183719-4eb3ca3feefb h1:lf5CH6YyPqBJhg7DEI7h75A/Bu4Sfv9OjPePr0mlDl0=
github.com/argoproj/gitops-engine v0.1.3-0.20201014183719-4eb3ca3feefb/go.mod h1:q1l0iuCyihknkeO3ne6cvOuagsp2NR+7ijRovlDz254=
github.com/argoproj/gitops-engine v0.1.3-0.20201027001456-31311943a57a h1:ShQaYWNaNKJ8iy65vkftl6jYbDU2kLiAdQ0XJ8LSlOo=
github.com/argoproj/gitops-engine v0.1.3-0.20201027001456-31311943a57a/go.mod h1:7Hzxz1c5YFXpAsM+i9L4LzKPnt8oY0t9QaGgEEUbQuc=
github.com/argoproj/pkg v0.2.0 h1:ETgC600kr8WcAi3MEVY5sA1H7H/u1/IysYOobwsZ8No=
github.com/argoproj/pkg v0.2.0/go.mod h1:F4TZgInLUEjzsWFB/BTJBsewoEy0ucnKSq6vmQiD/yc=
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
@ -111,6 +111,8 @@ github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnweb
github.com/blang/semver v3.5.0+incompatible h1:CGxCgetQ64DKk7rdZ++Vfnb1+ogGNnB17OJKJXD2Cfs=
github.com/blang/semver v3.5.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=
github.com/bombsimon/logrusr v0.0.0-20200131103305-03a291ce59b4 h1:Myj4mlaLi25AoncNPb8uf+Riru0Mp4xw7S9RUxBCYxk=
github.com/bombsimon/logrusr v0.0.0-20200131103305-03a291ce59b4/go.mod h1:Jq0nHtvxabKE5EMwAAdgTaz7dfWE8C4i11NOltxGQpc=
github.com/caddyserver/caddy v1.0.3/go.mod h1:G+ouvOY32gENkJC+jhgl62TyhvqEsFaDiZ4uw0RzP1E=
github.com/casbin/casbin v1.9.1 h1:ucjbS5zTrmSLtH4XogqOG920Poe6QatdXtz1FEbApeM=
github.com/casbin/casbin v1.9.1/go.mod h1:z8uPsfBJGUsnkagrt3G8QvjgTKFMBJ32UP8HpZllfog=
@ -236,6 +238,8 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V
github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas=
github.com/go-logr/logr v0.2.0 h1:QvGt2nLcHH0WK9orKa+ppBPAxREcH364nPUedEpK0TY=
github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU=
github.com/go-logr/logr v0.2.1 h1:fV3MLmabKIZ383XifUjFSwcoGee0v9qgPp8wy5svibE=
github.com/go-logr/logr v0.2.1/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU=
github.com/go-openapi/analysis v0.0.0-20180825180245-b006789cd277/go.mod h1:k70tL6pCuVxPJOHXQ+wIac1FUrvNkHolPie/cLEU6hI=
github.com/go-openapi/analysis v0.17.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik=
github.com/go-openapi/analysis v0.18.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik=
@ -324,6 +328,8 @@ github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200j
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
github.com/golang/mock v1.4.4 h1:l75CXGRSwbaYNpl/Z2X1XIIAMSCquvXgpVZDhwEIJsc=
github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=

View file

@ -15,9 +15,6 @@ import (
"sync"
"time"
"github.com/argoproj/argo-cd/util/kube"
argoio "github.com/argoproj/gitops-engine/pkg/utils/io"
"github.com/coreos/go-oidc"
"github.com/dgrijalva/jwt-go"
log "github.com/sirupsen/logrus"
@ -43,6 +40,8 @@ import (
"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
argoappv1 "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
grpc_util "github.com/argoproj/argo-cd/util/grpc"
argoio "github.com/argoproj/argo-cd/util/io"
"github.com/argoproj/argo-cd/util/kube"
"github.com/argoproj/argo-cd/util/localconfig"
oidcutil "github.com/argoproj/argo-cd/util/oidc"
tls_util "github.com/argoproj/argo-cd/util/tls"

View file

@ -11,13 +11,13 @@ import (
"strconv"
"strings"
argocderrors "github.com/argoproj/gitops-engine/pkg/utils/errors"
argoio "github.com/argoproj/gitops-engine/pkg/utils/io"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
argocderrors "github.com/argoproj/argo-cd/util/errors"
argoio "github.com/argoproj/argo-cd/util/io"
"github.com/argoproj/argo-cd/util/rand"
)

View file

@ -4,7 +4,6 @@ import (
"crypto/tls"
"time"
"github.com/argoproj/gitops-engine/pkg/utils/io"
grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
grpc_retry "github.com/grpc-ecosystem/go-grpc-middleware/retry"
log "github.com/sirupsen/logrus"
@ -12,6 +11,7 @@ import (
"google.golang.org/grpc/credentials"
argogrpc "github.com/argoproj/argo-cd/util/grpc"
"github.com/argoproj/argo-cd/util/io"
)
const (

View file

@ -3,7 +3,7 @@ package mocks
import (
apiclient "github.com/argoproj/argo-cd/reposerver/apiclient"
io "github.com/argoproj/gitops-engine/pkg/utils/io"
io "github.com/argoproj/argo-cd/util/io"
)
type Clientset struct {

View file

@ -4,7 +4,7 @@ import (
"io"
"sync"
ioutil "github.com/argoproj/gitops-engine/pkg/utils/io"
ioutil "github.com/argoproj/argo-cd/util/io"
)
func NewRepositoryLock() *repositoryLock {

View file

@ -8,7 +8,7 @@ import (
"github.com/stretchr/testify/assert"
util "github.com/argoproj/gitops-engine/pkg/utils/io"
util "github.com/argoproj/argo-cd/util/io"
)
// execute given action and return false if action have not completed within 1 second

View file

@ -17,7 +17,6 @@ import (
"github.com/Masterminds/semver"
"github.com/TomOnTime/utfutil"
"github.com/argoproj/gitops-engine/pkg/utils/io"
"github.com/argoproj/gitops-engine/pkg/utils/kube"
textutils "github.com/argoproj/gitops-engine/pkg/utils/text"
"github.com/argoproj/pkg/sync"
@ -44,6 +43,7 @@ import (
"github.com/argoproj/argo-cd/util/git"
"github.com/argoproj/argo-cd/util/gpg"
"github.com/argoproj/argo-cd/util/helm"
"github.com/argoproj/argo-cd/util/io"
"github.com/argoproj/argo-cd/util/ksonnet"
argokube "github.com/argoproj/argo-cd/util/kube"
"github.com/argoproj/argo-cd/util/kustomize"

View file

@ -15,7 +15,6 @@ import (
"time"
"github.com/Masterminds/semver"
"github.com/argoproj/gitops-engine/pkg/utils/io"
"github.com/ghodss/yaml"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
@ -33,6 +32,7 @@ import (
gitmocks "github.com/argoproj/argo-cd/util/git/mocks"
"github.com/argoproj/argo-cd/util/helm"
helmmocks "github.com/argoproj/argo-cd/util/helm/mocks"
"github.com/argoproj/argo-cd/util/io"
)
const testSignature = `gpg: Signature made Wed Feb 26 23:22:34 2020 CET

View file

@ -98,7 +98,7 @@ func TestLuaResourceActionsScript(t *testing.T) {
expectedObj := getObj(filepath.Join(dir, test.ExpectedOutputPath))
// Ideally, we would use a assert.Equal to detect the difference, but the Lua VM returns a object with float64 instead of the original int32. As a result, the assert.Equal is never true despite that the change has been applied.
diffResult, err := diff.Diff(expectedObj, result, testNormalizer{}, diff.GetDefaultDiffOptions())
diffResult, err := diff.Diff(expectedObj, result, diff.WithNormalizer(testNormalizer{}))
assert.NoError(t, err)
if diffResult.Modified {
t.Error("Output does not match input:")

View file

@ -8,11 +8,11 @@ import (
"testing"
"github.com/argoproj/gitops-engine/pkg/health"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
"github.com/ghodss/yaml"
"github.com/stretchr/testify/assert"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/lua"
)

View file

@ -5,7 +5,6 @@ import (
"testing"
"time"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
"github.com/dgrijalva/jwt-go"
"github.com/stretchr/testify/assert"
"google.golang.org/grpc/codes"
@ -18,6 +17,7 @@ import (
"github.com/argoproj/argo-cd/pkg/apiclient/account"
sessionpkg "github.com/argoproj/argo-cd/pkg/apiclient/session"
"github.com/argoproj/argo-cd/server/session"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/password"
"github.com/argoproj/argo-cd/util/rbac"
sessionutil "github.com/argoproj/argo-cd/util/session"

View file

@ -16,7 +16,6 @@ import (
"github.com/Masterminds/semver"
"github.com/argoproj/gitops-engine/pkg/diff"
"github.com/argoproj/gitops-engine/pkg/sync/common"
"github.com/argoproj/gitops-engine/pkg/utils/io"
"github.com/argoproj/gitops-engine/pkg/utils/kube"
"github.com/argoproj/gitops-engine/pkg/utils/text"
"github.com/argoproj/pkg/sync"
@ -53,6 +52,7 @@ import (
"github.com/argoproj/argo-cd/util/env"
"github.com/argoproj/argo-cd/util/git"
"github.com/argoproj/argo-cd/util/helm"
"github.com/argoproj/argo-cd/util/io"
"github.com/argoproj/argo-cd/util/lua"
"github.com/argoproj/argo-cd/util/rbac"
"github.com/argoproj/argo-cd/util/session"

View file

@ -7,7 +7,6 @@ import (
"time"
synccommon "github.com/argoproj/gitops-engine/pkg/sync/common"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
"github.com/argoproj/gitops-engine/pkg/utils/kube/kubetest"
"github.com/argoproj/pkg/sync"
"github.com/dgrijalva/jwt-go"
@ -38,6 +37,7 @@ import (
"github.com/argoproj/argo-cd/util/assets"
"github.com/argoproj/argo-cd/util/cache"
"github.com/argoproj/argo-cd/util/db"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/rbac"
"github.com/argoproj/argo-cd/util/settings"
)

View file

@ -4,7 +4,6 @@ import (
"fmt"
"reflect"
"github.com/argoproj/gitops-engine/pkg/utils/io"
"github.com/argoproj/gitops-engine/pkg/utils/kube"
"github.com/argoproj/gitops-engine/pkg/utils/text"
log "github.com/sirupsen/logrus"
@ -21,6 +20,7 @@ import (
"github.com/argoproj/argo-cd/server/rbacpolicy"
"github.com/argoproj/argo-cd/util/argo"
"github.com/argoproj/argo-cd/util/db"
"github.com/argoproj/argo-cd/util/io"
"github.com/argoproj/argo-cd/util/rbac"
"github.com/argoproj/argo-cd/util/settings"
)

View file

@ -19,9 +19,6 @@ import (
// nolint:staticcheck
golang_proto "github.com/golang/protobuf/proto"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
"github.com/argoproj/gitops-engine/pkg/utils/io"
"github.com/argoproj/gitops-engine/pkg/utils/kube"
"github.com/argoproj/pkg/jwt/zjwt"
"github.com/argoproj/pkg/sync"
"github.com/dgrijalva/jwt-go"
@ -89,9 +86,12 @@ import (
"github.com/argoproj/argo-cd/util/dex"
dexutil "github.com/argoproj/argo-cd/util/dex"
"github.com/argoproj/argo-cd/util/env"
"github.com/argoproj/argo-cd/util/errors"
grpc_util "github.com/argoproj/argo-cd/util/grpc"
"github.com/argoproj/argo-cd/util/healthz"
httputil "github.com/argoproj/argo-cd/util/http"
"github.com/argoproj/argo-cd/util/io"
kubeutil "github.com/argoproj/argo-cd/util/kube"
"github.com/argoproj/argo-cd/util/oidc"
"github.com/argoproj/argo-cd/util/rbac"
util_session "github.com/argoproj/argo-cd/util/session"
@ -516,7 +516,7 @@ func (a *ArgoCDServer) newGRPCServer() *grpc.Server {
)))
grpcS := grpc.NewServer(sOpts...)
db := db.NewDB(a.Namespace, a.settingsMgr, a.KubeClientset)
kubectl := &kube.KubectlCmd{}
kubectl := kubeutil.NewKubectl()
clusterService := cluster.NewServer(db, a.enf, a.Cache, kubectl)
repoService := repository.NewServer(a.RepoClientset, db, a.enf, a.Cache, a.settingsMgr)
repoCredsService := repocreds.NewServer(a.RepoClientset, db, a.enf, a.settingsMgr)

View file

@ -1,12 +1,11 @@
package session
import (
util "github.com/argoproj/argo-cd/util/io"
"github.com/argoproj/argo-cd/util/session"
"golang.org/x/sync/semaphore"
util "github.com/argoproj/gitops-engine/pkg/utils/io"
log "github.com/sirupsen/logrus"
"golang.org/x/sync/semaphore"
)
func NewLoginRateLimiter(maxNumber int) func() (util.Closer, error) {

View file

@ -3,9 +3,9 @@ package session
import (
"testing"
util "github.com/argoproj/gitops-engine/pkg/utils/io"
"github.com/stretchr/testify/assert"
util "github.com/argoproj/argo-cd/util/io"
"github.com/argoproj/argo-cd/util/session"
)

View file

@ -3,12 +3,12 @@ package session
import (
"context"
util "github.com/argoproj/gitops-engine/pkg/utils/io"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"github.com/argoproj/argo-cd/pkg/apiclient/session"
"github.com/argoproj/argo-cd/server/rbacpolicy"
util "github.com/argoproj/argo-cd/util/io"
sessionmgr "github.com/argoproj/argo-cd/util/session"
)

View file

@ -1,17 +1,24 @@
package version
import (
"github.com/argoproj/gitops-engine/pkg/utils/kube"
"github.com/golang/protobuf/ptypes/empty"
"golang.org/x/net/context"
"errors"
"fmt"
"os/exec"
"regexp"
"strings"
"github.com/argoproj/gitops-engine/pkg/utils/tracing"
"github.com/golang/protobuf/ptypes/empty"
"github.com/google/go-jsonnet"
"github.com/sirupsen/logrus"
"golang.org/x/net/context"
"github.com/argoproj/argo-cd/common"
"github.com/argoproj/argo-cd/pkg/apiclient/version"
"github.com/argoproj/argo-cd/util/helm"
ksutil "github.com/argoproj/argo-cd/util/ksonnet"
"github.com/argoproj/argo-cd/util/kustomize"
"github.com/argoproj/argo-cd/util/log"
)
type Server struct {
@ -22,6 +29,27 @@ type Server struct {
jsonnetVersion string
}
func getVersion() (string, error) {
span := tracing.NewLoggingTracer(log.NewLogrusLogger(logrus.New())).StartSpan("Version")
defer span.Finish()
cmd := exec.Command("kubectl", "version", "--client")
out, err := cmd.CombinedOutput()
if err != nil {
return "", fmt.Errorf("could not get kubectl version: %s", err)
}
re := regexp.MustCompile(`GitVersion:"([a-zA-Z0-9\.\-]+)"`)
matches := re.FindStringSubmatch(string(out))
if len(matches) != 2 {
return "", errors.New("could not get kubectl version")
}
version := matches[1]
if version[0] != 'v' {
version = "v" + version
}
return strings.TrimSpace(version), nil
}
// Version returns the version of the API server
func (s *Server) Version(context.Context, *empty.Empty) (*version.VersionMessage, error) {
vers := common.GetVersion()
@ -50,7 +78,7 @@ func (s *Server) Version(context.Context, *empty.Empty) (*version.VersionMessage
}
}
if s.kubectlVersion == "" {
kubectlVersion, err := kube.Version()
kubectlVersion, err := getVersion()
if err == nil {
s.kubectlVersion = kubectlVersion
} else {

View file

@ -4,7 +4,6 @@ import (
"context"
"testing"
"github.com/argoproj/gitops-engine/pkg/utils/io"
"github.com/argoproj/pkg/errors"
"github.com/stretchr/testify/assert"
"google.golang.org/grpc/codes"
@ -13,6 +12,7 @@ import (
argocdclient "github.com/argoproj/argo-cd/pkg/apiclient"
"github.com/argoproj/argo-cd/pkg/apiclient/session"
. "github.com/argoproj/argo-cd/test/e2e/fixture"
"github.com/argoproj/argo-cd/util/io"
)
func TestCreateAndUseAccount(t *testing.T) {

View file

@ -7,13 +7,13 @@ import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
. "github.com/argoproj/gitops-engine/pkg/sync/common"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
"github.com/stretchr/testify/assert"
"k8s.io/apimachinery/pkg/types"
. "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/test/e2e/fixture"
. "github.com/argoproj/argo-cd/test/e2e/fixture/app"
"github.com/argoproj/argo-cd/util/errors"
)
func TestAutoSyncSelfHealDisabled(t *testing.T) {

View file

@ -15,8 +15,6 @@ import (
"github.com/argoproj/gitops-engine/pkg/diff"
"github.com/argoproj/gitops-engine/pkg/health"
. "github.com/argoproj/gitops-engine/pkg/sync/common"
. "github.com/argoproj/gitops-engine/pkg/utils/errors"
"github.com/argoproj/gitops-engine/pkg/utils/io"
"github.com/argoproj/gitops-engine/pkg/utils/kube"
"github.com/argoproj/pkg/errors"
log "github.com/sirupsen/logrus"
@ -37,6 +35,8 @@ import (
. "github.com/argoproj/argo-cd/test/e2e/fixture"
. "github.com/argoproj/argo-cd/test/e2e/fixture/app"
. "github.com/argoproj/argo-cd/util/argo"
. "github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/io"
"github.com/argoproj/argo-cd/util/settings"
)

View file

@ -6,9 +6,8 @@ import (
"github.com/stretchr/testify/assert"
. "github.com/argoproj/gitops-engine/pkg/utils/errors"
. "github.com/argoproj/argo-cd/test/e2e/fixture"
. "github.com/argoproj/argo-cd/util/errors"
)
func TestClusterList(t *testing.T) {

View file

@ -8,12 +8,12 @@ import (
"github.com/argoproj/gitops-engine/pkg/health"
. "github.com/argoproj/gitops-engine/pkg/sync/common"
. "github.com/argoproj/gitops-engine/pkg/utils/errors"
"github.com/stretchr/testify/assert"
. "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
. "github.com/argoproj/argo-cd/test/e2e/fixture"
. "github.com/argoproj/argo-cd/test/e2e/fixture/app"
. "github.com/argoproj/argo-cd/util/errors"
)
// make sure we can echo back the Git creds

View file

@ -4,12 +4,12 @@ import (
"fmt"
"io/ioutil"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
log "github.com/sirupsen/logrus"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
. "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/test/e2e/fixture"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/grpc"
)

View file

@ -5,12 +5,12 @@ import (
"time"
"github.com/argoproj/gitops-engine/pkg/health"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
log "github.com/sirupsen/logrus"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
. "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/test/e2e/fixture"
"github.com/argoproj/argo-cd/util/errors"
)
// this implements the "then" part of given/when/then

View file

@ -5,9 +5,8 @@ import (
"os"
"path/filepath"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
"github.com/argoproj/argo-cd/test/e2e/fixture"
"github.com/argoproj/argo-cd/util/errors"
)
// Add a custom CA certificate to the test and also create the certificate file

View file

@ -11,8 +11,6 @@ import (
"testing"
"time"
. "github.com/argoproj/gitops-engine/pkg/utils/errors"
"github.com/argoproj/gitops-engine/pkg/utils/io"
"github.com/argoproj/pkg/errors"
jsonpatch "github.com/evanphx/json-patch"
"github.com/ghodss/yaml"
@ -29,7 +27,9 @@ import (
sessionpkg "github.com/argoproj/argo-cd/pkg/apiclient/session"
"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
appclientset "github.com/argoproj/argo-cd/pkg/client/clientset/versioned"
. "github.com/argoproj/argo-cd/util/errors"
grpcutil "github.com/argoproj/argo-cd/util/grpc"
"github.com/argoproj/argo-cd/util/io"
"github.com/argoproj/argo-cd/util/rand"
"github.com/argoproj/argo-cd/util/settings"
)

View file

@ -6,9 +6,8 @@ import (
"os"
"path/filepath"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
"github.com/argoproj/argo-cd/test/e2e/fixture"
"github.com/argoproj/argo-cd/util/errors"
)
// Add GPG public key via API and create appropriate file where the ConfigMap mount would de it as well

View file

@ -3,9 +3,8 @@ package repos
import (
"path/filepath"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
"github.com/argoproj/argo-cd/test/e2e/fixture"
"github.com/argoproj/argo-cd/util/errors"
)
var (

View file

@ -6,7 +6,7 @@ import (
"strings"
"text/template"
. "github.com/argoproj/gitops-engine/pkg/utils/errors"
. "github.com/argoproj/argo-cd/util/errors"
)
// utility method to template a string using a map

View file

@ -5,7 +5,7 @@ import (
"fmt"
"strings"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
"github.com/argoproj/argo-cd/util/errors"
)
type Versions struct {

View file

@ -11,7 +11,6 @@ import (
"github.com/argoproj/gitops-engine/pkg/health"
. "github.com/argoproj/gitops-engine/pkg/sync/common"
. "github.com/argoproj/gitops-engine/pkg/utils/errors"
"github.com/stretchr/testify/assert"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@ -22,6 +21,7 @@ import (
. "github.com/argoproj/argo-cd/test/e2e/fixture"
. "github.com/argoproj/argo-cd/test/e2e/fixture/app"
"github.com/argoproj/argo-cd/test/e2e/fixture/repos"
. "github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/settings"
)

View file

@ -10,11 +10,11 @@ import (
"github.com/argoproj/gitops-engine/pkg/health"
. "github.com/argoproj/gitops-engine/pkg/sync/common"
. "github.com/argoproj/gitops-engine/pkg/utils/errors"
. "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
. "github.com/argoproj/argo-cd/test/e2e/fixture"
. "github.com/argoproj/argo-cd/test/e2e/fixture/app"
. "github.com/argoproj/argo-cd/util/errors"
)
func TestPreSyncHookSuccessful(t *testing.T) {

View file

@ -4,13 +4,13 @@ import (
"testing"
. "github.com/argoproj/gitops-engine/pkg/sync/common"
. "github.com/argoproj/gitops-engine/pkg/utils/errors"
"github.com/argoproj/gitops-engine/pkg/utils/kube"
"github.com/stretchr/testify/assert"
. "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
. "github.com/argoproj/argo-cd/test/e2e/fixture"
. "github.com/argoproj/argo-cd/test/e2e/fixture/app"
. "github.com/argoproj/argo-cd/util/errors"
)
func TestJsonnetAppliedCorrectly(t *testing.T) {

View file

@ -5,12 +5,12 @@ import (
"github.com/argoproj/gitops-engine/pkg/health"
. "github.com/argoproj/gitops-engine/pkg/sync/common"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
"github.com/stretchr/testify/assert"
. "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/test/e2e/fixture"
. "github.com/argoproj/argo-cd/test/e2e/fixture/app"
"github.com/argoproj/argo-cd/util/errors"
)
func TestKustomize2AppSource(t *testing.T) {

View file

@ -4,10 +4,9 @@ import (
"fmt"
"testing"
. "github.com/argoproj/gitops-engine/pkg/utils/errors"
"github.com/argoproj/argo-cd/test/e2e/fixture"
. "github.com/argoproj/argo-cd/test/e2e/fixture/app"
. "github.com/argoproj/argo-cd/util/errors"
)
// make sure you cannot create an app from a private repo without set-up

View file

@ -4,13 +4,13 @@ import (
"context"
"testing"
argoio "github.com/argoproj/gitops-engine/pkg/utils/io"
"github.com/stretchr/testify/assert"
repositorypkg "github.com/argoproj/argo-cd/pkg/apiclient/repository"
"github.com/argoproj/argo-cd/test/e2e/fixture"
"github.com/argoproj/argo-cd/test/e2e/fixture/app"
"github.com/argoproj/argo-cd/test/e2e/fixture/repos"
argoio "github.com/argoproj/argo-cd/util/io"
"github.com/argoproj/argo-cd/util/settings"
)

View file

@ -7,12 +7,12 @@ import (
"github.com/argoproj/gitops-engine/pkg/health"
. "github.com/argoproj/gitops-engine/pkg/sync/common"
. "github.com/argoproj/gitops-engine/pkg/utils/errors"
. "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/test/e2e/fixture"
. "github.com/argoproj/argo-cd/test/e2e/fixture"
. "github.com/argoproj/argo-cd/test/e2e/fixture/app"
. "github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/rand"
)

View file

@ -6,13 +6,13 @@ import (
"testing"
. "github.com/argoproj/gitops-engine/pkg/sync/common"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
. "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/test/e2e/fixture"
. "github.com/argoproj/argo-cd/test/e2e/fixture/app"
"github.com/argoproj/argo-cd/util/errors"
)
// TestSyncOptionsValidateFalse verifies we can disable validation during kubectl apply, using the

View file

@ -5,7 +5,7 @@ import (
"os"
"path/filepath"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
"github.com/argoproj/argo-cd/util/errors"
)
type AddBinDirToPath struct {

View file

@ -6,7 +6,7 @@ import (
argoexec "github.com/argoproj/pkg/exec"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
"github.com/argoproj/argo-cd/util/errors"
)
var Author string

View file

@ -7,7 +7,6 @@ import (
"strings"
"time"
"github.com/argoproj/gitops-engine/pkg/utils/io"
"github.com/argoproj/gitops-engine/pkg/utils/kube"
log "github.com/sirupsen/logrus"
"google.golang.org/grpc/codes"
@ -25,6 +24,7 @@ import (
"github.com/argoproj/argo-cd/util/db"
"github.com/argoproj/argo-cd/util/git"
"github.com/argoproj/argo-cd/util/helm"
"github.com/argoproj/argo-cd/util/io"
"github.com/argoproj/argo-cd/util/settings"
)

3
util/cache/redis.go vendored
View file

@ -4,7 +4,8 @@ import (
"context"
"time"
ioutil "github.com/argoproj/gitops-engine/pkg/utils/io"
ioutil "github.com/argoproj/argo-cd/util/io"
rediscache "github.com/go-redis/cache/v8"
"github.com/go-redis/redis/v8"
)

View file

@ -14,8 +14,6 @@ import (
"strconv"
"strings"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
"github.com/argoproj/gitops-engine/pkg/utils/io"
"github.com/google/shlex"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
@ -27,6 +25,8 @@ import (
"sigs.k8s.io/yaml"
"github.com/argoproj/argo-cd/common"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/io"
)
// NewVersionCmd returns a new `version` command to be used as a sub-command to root

View file

@ -5,7 +5,6 @@ import (
"io/ioutil"
"testing"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
"github.com/ghodss/yaml"
"github.com/stretchr/testify/assert"
corev1 "k8s.io/api/core/v1"
@ -14,6 +13,8 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/kubernetes/fake"
kubetesting "k8s.io/client-go/testing"
"github.com/argoproj/argo-cd/util/errors"
)
const (

View file

@ -12,7 +12,7 @@ import (
"regexp"
"strconv"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
"github.com/argoproj/argo-cd/util/errors"
)
var messageRe = regexp.MustCompile(`<p>(.*)([\s\S]*?)<\/p>`)

View file

@ -5,7 +5,7 @@ import (
"os"
"testing"
util "github.com/argoproj/gitops-engine/pkg/utils/io"
util "github.com/argoproj/argo-cd/util/io"
"github.com/stretchr/testify/assert"
)

59
util/errors/errors.go Normal file
View file

@ -0,0 +1,59 @@
package errors
import (
"os"
log "github.com/sirupsen/logrus"
)
const (
// ErrorCommandSpecific is reserved for command specific indications
ErrorCommandSpecific = 1
// ErrorConnectionFailure is returned on connection failure to API endpoint
ErrorConnectionFailure = 11
// ErrorAPIResponse is returned on unexpected API response, i.e. authorization failure
ErrorAPIResponse = 12
// ErrorResourceDoesNotExist is returned when the requested resource does not exist
ErrorResourceDoesNotExist = 13
// ErrorGeneric is returned for generic error
ErrorGeneric = 20
)
// CheckError logs a fatal message and exits with ErrorGeneric if err is not nil
func CheckError(err error) {
if err != nil {
Fatal(ErrorGeneric, err)
}
}
// CheckErrorWithCode is a convenience function to exit if an error is non-nil and exit if it was
func CheckErrorWithCode(err error, exitcode int) {
if err != nil {
Fatal(exitcode, err)
}
}
// FailOnErr panics if there is an error. It returns the first value so you can use it if you cast it:
// text := FailOrErr(Foo)).(string)
func FailOnErr(v interface{}, err error) interface{} {
CheckError(err)
return v
}
// Fatal is a wrapper for logrus.Fatal() to exit with custom code
func Fatal(exitcode int, args ...interface{}) {
exitfunc := func() {
os.Exit(exitcode)
}
log.RegisterExitHandler(exitfunc)
log.Fatal(args...)
}
// Fatalf is a wrapper for logrus.Fatalf() to exit with custom code
func Fatalf(exitcode int, format string, args ...interface{}) {
exitfunc := func() {
os.Exit(exitcode)
}
log.RegisterExitHandler(exitfunc)
log.Fatalf(format, args...)
}

View file

@ -6,6 +6,10 @@ import (
"os/exec"
"time"
"github.com/sirupsen/logrus"
"github.com/argoproj/argo-cd/util/log"
argoexec "github.com/argoproj/pkg/exec"
tracing "github.com/argoproj/gitops-engine/pkg/utils/tracing"
@ -30,7 +34,7 @@ func Run(cmd *exec.Cmd) (string, error) {
}
func RunWithRedactor(cmd *exec.Cmd, redactor func(text string) string) (string, error) {
span := tracing.StartSpan(fmt.Sprintf("exec %v", cmd.Args[0]))
span := tracing.NewLoggingTracer(log.NewLogrusLogger(logrus.New())).StartSpan(fmt.Sprintf("exec %v", cmd.Args[0]))
span.SetBaggageItem("dir", fmt.Sprintf("%v", cmd.Dir))
span.SetBaggageItem("args", fmt.Sprintf("%v", cmd.Args))
defer span.Finish()

View file

@ -17,12 +17,12 @@ import (
"time"
"github.com/Masterminds/semver"
"github.com/argoproj/gitops-engine/pkg/utils/io"
"github.com/argoproj/pkg/sync"
log "github.com/sirupsen/logrus"
"gopkg.in/yaml.v2"
executil "github.com/argoproj/argo-cd/util/exec"
"github.com/argoproj/argo-cd/util/io"
)
var (

View file

@ -5,8 +5,9 @@ import (
"testing"
"github.com/Masterminds/semver"
"github.com/argoproj/gitops-engine/pkg/utils/io"
"github.com/stretchr/testify/assert"
"github.com/argoproj/argo-cd/util/io"
)
func TestIndex(t *testing.T) {

View file

@ -9,9 +9,8 @@ import (
"path/filepath"
"regexp"
"github.com/argoproj/gitops-engine/pkg/utils/io"
executil "github.com/argoproj/argo-cd/util/exec"
"github.com/argoproj/argo-cd/util/io"
)
// A thin wrapper around the "helm" command, adding logging and error translation.

View file

@ -5,7 +5,7 @@ package mocks
import (
helm "github.com/argoproj/argo-cd/util/helm"
io "github.com/argoproj/gitops-engine/pkg/utils/io"
io "github.com/argoproj/argo-cd/util/io"
mock "github.com/stretchr/testify/mock"

33
util/io/closer.go Normal file
View file

@ -0,0 +1,33 @@
package io
import log "github.com/sirupsen/logrus"
var (
NopCloser = NewCloser(func() error {
return nil
})
)
type Closer interface {
Close() error
}
type inlineCloser struct {
close func() error
}
func (c *inlineCloser) Close() error {
return c.close()
}
func NewCloser(close func() error) Closer {
return &inlineCloser{close: close}
}
// Close is a convenience function to close a object that has a Close() method, ignoring any errors
// Used to satisfy errcheck lint
func Close(c Closer) {
if err := c.Close(); err != nil {
log.Warnf("failed to close %v: %v", c, err)
}
}

23
util/kube/kubectl.go Normal file
View file

@ -0,0 +1,23 @@
package kube
import (
"os"
"github.com/argoproj/argo-cd/util/log"
"github.com/argoproj/gitops-engine/pkg/utils/kube"
"github.com/argoproj/gitops-engine/pkg/utils/tracing"
"github.com/sirupsen/logrus"
)
var tracer tracing.Tracer = &tracing.NopTracer{}
func init() {
if os.Getenv("ARGOCD_TRACING_ENABLED") == "1" {
tracer = tracing.NewLoggingTracer(log.NewLogrusLogger(logrus.New()))
}
}
func NewKubectl() kube.Kubectl {
return &kube.KubectlCmd{Tracer: tracer, Log: log.NewLogrusLogger(logrus.New())}
}

View file

@ -9,13 +9,14 @@ import (
"net/http"
"os"
"github.com/argoproj/gitops-engine/pkg/utils/io"
"github.com/pkg/errors"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientcmd"
"k8s.io/client-go/tools/portforward"
"k8s.io/client-go/transport/spdy"
"github.com/argoproj/argo-cd/util/io"
)
func PortForward(podSelector string, targetPort int, namespace string) (int, error) {

11
util/log/logrus.go Normal file
View file

@ -0,0 +1,11 @@
package log
import (
adapter "github.com/bombsimon/logrusr"
"github.com/go-logr/logr"
"github.com/sirupsen/logrus"
)
func NewLogrusLogger(fieldLogger logrus.FieldLogger) logr.Logger {
return adapter.NewLogger(fieldLogger)
}

View file

@ -9,7 +9,6 @@ import (
"testing"
"time"
"github.com/argoproj/gitops-engine/pkg/utils/errors"
"github.com/dgrijalva/jwt-go"
"github.com/stretchr/testify/assert"
"google.golang.org/grpc/codes"
@ -19,6 +18,7 @@ import (
"k8s.io/client-go/kubernetes/fake"
"github.com/argoproj/argo-cd/common"
"github.com/argoproj/argo-cd/util/errors"
"github.com/argoproj/argo-cd/util/password"
"github.com/argoproj/argo-cd/util/settings"
)

View file

@ -15,7 +15,6 @@ import (
"sync"
"time"
"github.com/argoproj/gitops-engine/pkg/diff"
"github.com/ghodss/yaml"
log "github.com/sirupsen/logrus"
apiv1 "k8s.io/api/core/v1"
@ -280,7 +279,7 @@ const (
)
type ArgoCDDiffOptions struct {
diff.DiffOptions
IgnoreAggregatedRoles bool `json:"ignoreAggregatedRoles,omitempty"`
// If set to true then differences caused by status are ignored.
IgnoreResourceStatusField IgnoreStatus `json:"ignoreResourceStatusField,omitempty"`
@ -518,10 +517,14 @@ func addStatusOverrideToGK(resourceOverrides map[string]v1alpha1.ResourceOverrid
}
}
func GetDefaultDiffOptions() ArgoCDDiffOptions {
return ArgoCDDiffOptions{IgnoreAggregatedRoles: false}
}
// GetResourceCompareOptions loads the resource compare options settings from the ConfigMap
func (mgr *SettingsManager) GetResourceCompareOptions() (diff.DiffOptions, error) {
func (mgr *SettingsManager) GetResourceCompareOptions() (ArgoCDDiffOptions, error) {
// We have a sane set of default diff options
diffOptions := diff.GetDefaultDiffOptions()
diffOptions := GetDefaultDiffOptions()
argoCDCM, err := mgr.getConfigMap()
if err != nil {

View file

@ -7,7 +7,6 @@ import (
"github.com/argoproj/argo-cd/common"
"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
"github.com/argoproj/gitops-engine/pkg/diff"
"github.com/stretchr/testify/assert"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@ -260,7 +259,7 @@ func TestGetResourceCompareOptions(t *testing.T) {
"resource.compareoptions": "",
})
compareOptions, err := settingsManager.GetResourceCompareOptions()
defaultOptions := diff.GetDefaultDiffOptions()
defaultOptions := GetDefaultDiffOptions()
assert.NoError(t, err)
assert.Equal(t, defaultOptions.IgnoreAggregatedRoles, compareOptions.IgnoreAggregatedRoles)
}
@ -269,7 +268,7 @@ func TestGetResourceCompareOptions(t *testing.T) {
{
_, settingsManager := fixtures(map[string]string{})
compareOptions, err := settingsManager.GetResourceCompareOptions()
defaultOptions := diff.GetDefaultDiffOptions()
defaultOptions := GetDefaultDiffOptions()
assert.NoError(t, err)
assert.Equal(t, defaultOptions.IgnoreAggregatedRoles, compareOptions.IgnoreAggregatedRoles)
}