From 4b412b3bf4442d19ca90399d5d6cf238ee55fea3 Mon Sep 17 00:00:00 2001 From: Matt Morrison Date: Tue, 25 Jul 2023 11:04:50 +1200 Subject: [PATCH] resolve PR review comments --- pkg/app_watcher/appwatcher.go | 9 +++++---- pkg/server/hook_handler.go | 2 +- pkg/server/server.go | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/pkg/app_watcher/appwatcher.go b/pkg/app_watcher/appwatcher.go index 1a8a74b5..716e990a 100644 --- a/pkg/app_watcher/appwatcher.go +++ b/pkg/app_watcher/appwatcher.go @@ -2,6 +2,7 @@ package app_watcher import ( "context" + appclientset "github.com/argoproj/argo-cd/v2/pkg/client/clientset/versioned" "github.com/rs/zerolog/log" "github.com/zapier/kubechecks/pkg/config" @@ -10,7 +11,7 @@ import ( "strings" "time" - appv1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1" + appv1alpha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1" applisters "github.com/argoproj/argo-cd/v2/pkg/client/listers/application/v1alpha1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" apiruntime "k8s.io/apimachinery/pkg/runtime" @@ -78,7 +79,7 @@ func (ctrl *ApplicationWatcher) onApplicationAdded(obj interface{}) { log.Error().Err(err).Msg("appwatcher: could not get key for added application") } log.Trace().Str("key", key).Msg("appwatcher: onApplicationAdded") - ctrl.cfg.VcsToArgoMap.AddApp(obj.(*appv1.Application)) + ctrl.cfg.VcsToArgoMap.AddApp(obj.(*appv1alpha1.Application)) } func (ctrl *ApplicationWatcher) onApplicationUpdated(old, new interface{}) { @@ -119,7 +120,7 @@ func (ctrl *ApplicationWatcher) newApplicationInformerAndLister() (cache.SharedI return ctrl.applicationClientset.ArgoprojV1alpha1().Applications(ctrl.cfg.ArgoCdNamespace).Watch(context.TODO(), options) }, }, - &appv1.Application{}, + &appv1alpha1.Application{}, refreshTimeout, cache.Indexers{ cache.NamespaceIndex: func(obj interface{}) ([]string, error) { @@ -139,7 +140,7 @@ func (ctrl *ApplicationWatcher) newApplicationInformerAndLister() (cache.SharedI } func canProcessApp(obj interface{}) bool { - app, ok := obj.(*appv1.Application) + app, ok := obj.(*appv1alpha1.Application) if !ok { return false } diff --git a/pkg/server/hook_handler.go b/pkg/server/hook_handler.go index ee93eda8..afa26054 100644 --- a/pkg/server/hook_handler.go +++ b/pkg/server/hook_handler.go @@ -3,7 +3,6 @@ package server import ( "context" "fmt" - "github.com/zapier/kubechecks/pkg/config" "net/http" "strings" "sync" @@ -11,6 +10,7 @@ import ( "github.com/labstack/echo/v4" "github.com/rs/zerolog/log" "github.com/spf13/viper" + "github.com/zapier/kubechecks/pkg/config" "github.com/zapier/kubechecks/pkg/events" "github.com/zapier/kubechecks/pkg/github_client" "github.com/zapier/kubechecks/pkg/gitlab_client" diff --git a/pkg/server/server.go b/pkg/server/server.go index 2e211d07..9ff33039 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -2,8 +2,6 @@ package server import ( "context" - "github.com/zapier/kubechecks/pkg/app_watcher" - "github.com/zapier/kubechecks/pkg/config" "net/url" "strings" @@ -14,7 +12,9 @@ import ( "github.com/pkg/errors" "github.com/rs/zerolog/log" "github.com/spf13/viper" + "github.com/zapier/kubechecks/pkg/app_watcher" "github.com/zapier/kubechecks/pkg/argo_client" + "github.com/zapier/kubechecks/pkg/config" "github.com/zapier/kubechecks/pkg/vcs_clients" "github.com/ziflex/lecho/v3" )