From 47d239312a943b4762a9e0d11ace3c82694f9e4b Mon Sep 17 00:00:00 2001 From: stefanprodan Date: Mon, 13 Jul 2020 17:14:13 +0300 Subject: [PATCH] Update source-controller to v0.0.5 --- Makefile | 2 +- config/default/kustomization.yaml | 4 ++-- controllers/gitrepository_watcher.go | 4 ++-- controllers/kustomization_controller.go | 2 +- go.mod | 2 +- go.sum | 4 ++-- main.go | 7 ++++--- 7 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index b2604c8..70f32d3 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ IMG ?= fluxcd/kustomize-controller:latest # Produce CRDs that work back to Kubernetes 1.13 CRD_OPTIONS ?= crd -SOURCE_VER ?= v0.0.2 +SOURCE_VER ?= v0.0.5 # Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) ifeq (,$(shell go env GOBIN)) diff --git a/config/default/kustomization.yaml b/config/default/kustomization.yaml index df237fd..512beff 100644 --- a/config/default/kustomization.yaml +++ b/config/default/kustomization.yaml @@ -5,6 +5,6 @@ resources: - ../crd - ../rbac - ../manager -- github.com/fluxcd/source-controller/config//crd?ref=v0.0.2 -- github.com/fluxcd/source-controller/config//manager?ref=v0.0.2 +- github.com/fluxcd/source-controller/config//crd?ref=v0.0.5 +- github.com/fluxcd/source-controller/config//manager?ref=v0.0.5 - namespace.yaml diff --git a/controllers/gitrepository_watcher.go b/controllers/gitrepository_watcher.go index 6df2f40..6afe21e 100644 --- a/controllers/gitrepository_watcher.go +++ b/controllers/gitrepository_watcher.go @@ -88,7 +88,7 @@ func (r *GitRepositoryWatcher) SetupWithManager(mgr ctrl.Manager) error { err := mgr.GetFieldIndexer().IndexField(context.TODO(), &kustomizev1.Kustomization{}, kustomizev1.SourceIndexKey, func(rawObj runtime.Object) []string { k := rawObj.(*kustomizev1.Kustomization) - if k.Spec.SourceRef.Kind == "GitRepository" { + if k.Spec.SourceRef.Kind == sourcev1.GitRepositoryKind { return []string{k.Spec.SourceRef.Name} } return nil @@ -120,7 +120,7 @@ func (r *GitRepositoryWatcher) requestReconciliation(kustomization kustomizev1.K if kustomization.Annotations == nil { kustomization.Annotations = make(map[string]string) } - kustomization.Annotations[kustomizev1.SyncAtAnnotation] = metav1.Now().String() + kustomization.Annotations[kustomizev1.ReconcileAtAnnotation] = metav1.Now().String() // Prevent strings can't be nil err as API package does not mark APIGroup with omitempty. if kustomization.Spec.SourceRef.APIGroup == nil { emptyAPIGroup := "" diff --git a/controllers/kustomization_controller.go b/controllers/kustomization_controller.go index f142361..0733521 100644 --- a/controllers/kustomization_controller.go +++ b/controllers/kustomization_controller.go @@ -92,7 +92,7 @@ func (r *KustomizationReconciler) Reconcile(req ctrl.Request) (ctrl.Result, erro var source sourcev1.Source // get artifact source from Git repository - if kustomization.Spec.SourceRef.Kind == "GitRepository" { + if kustomization.Spec.SourceRef.Kind == sourcev1.GitRepositoryKind { var repository sourcev1.GitRepository repositoryName := types.NamespacedName{ Namespace: kustomization.GetNamespace(), diff --git a/go.mod b/go.mod index 975072e..c04004f 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.13 require ( github.com/fluxcd/pkg v0.0.3 - github.com/fluxcd/source-controller v0.0.3 + github.com/fluxcd/source-controller v0.0.5 github.com/go-logr/logr v0.1.0 github.com/onsi/ginkgo v1.11.0 github.com/onsi/gomega v1.8.1 diff --git a/go.sum b/go.sum index 367aa5a..f46f1ff 100644 --- a/go.sum +++ b/go.sum @@ -179,8 +179,8 @@ github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fluxcd/pkg v0.0.3 h1:yhjtpGtD9LxFo8JtwTuUxJyFcX2wSSb0TPptIEpGSmA= github.com/fluxcd/pkg v0.0.3/go.mod h1:rtlppQU+9DNikyDZptLdOeTf+wBvQQiQQ/J113FPoeU= -github.com/fluxcd/source-controller v0.0.3 h1:CRk89b7+VPNcouqBdY6UHylMSn8dQEYSciqeci/T25A= -github.com/fluxcd/source-controller v0.0.3/go.mod h1:JQYoE8RuiUaQotUo5N/6l6YOp16EuSzZ8fV0r0ulv2Q= +github.com/fluxcd/source-controller v0.0.5 h1:flUhdZh00/+jzqf9/sSRUMrewp+VlNFDITnoQC7pO4A= +github.com/fluxcd/source-controller v0.0.5/go.mod h1:RhIhH7PE7jqPEaarhtMvCq9zKZp/qTslYtZsJuww9OI= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= diff --git a/main.go b/main.go index 1e4d06f..3ff994d 100644 --- a/main.go +++ b/main.go @@ -99,15 +99,16 @@ func main() { if err = (&controllers.GitRepositoryWatcher{ Client: mgr.GetClient(), - Log: ctrl.Log.WithName("controllers").WithName("GitRepository"), + Log: ctrl.Log.WithName("controllers").WithName(sourcev1.GitRepositoryKind), Scheme: mgr.GetScheme(), }).SetupWithManager(mgr); err != nil { setupLog.Error(err, "unable to create controller", "controller", "GitRepository") os.Exit(1) } + if err = (&controllers.KustomizationReconciler{ Client: mgr.GetClient(), - Log: ctrl.Log.WithName("controllers").WithName("Kustomization"), + Log: ctrl.Log.WithName("controllers").WithName(kustomizev1.KustomizationKind), Scheme: mgr.GetScheme(), EventRecorder: mgr.GetEventRecorderFor("kustomize-controller"), ExternalEventRecorder: eventRecorder, @@ -115,7 +116,7 @@ func main() { MaxConcurrentReconciles: concurrent, DependencyRequeueInterval: requeueDependency, }); err != nil { - setupLog.Error(err, "unable to create controller", "controller", "Kustomization") + setupLog.Error(err, "unable to create controller", "controller", kustomizev1.KustomizationKind) os.Exit(1) } // +kubebuilder:scaffold:builder