Update source-controller to v0.0.5

This commit is contained in:
stefanprodan 2020-07-13 17:14:13 +03:00
parent 57806b9fdd
commit 47d239312a
7 changed files with 13 additions and 12 deletions

View File

@ -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))

View File

@ -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

View File

@ -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 := ""

View File

@ -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(),

2
go.mod
View File

@ -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

4
go.sum
View File

@ -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=

View File

@ -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