diff --git a/api/v1alpha1/gitrepository_types.go b/api/v1alpha1/gitrepository_types.go index ea600369..6eaf283b 100644 --- a/api/v1alpha1/gitrepository_types.go +++ b/api/v1alpha1/gitrepository_types.go @@ -23,6 +23,8 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) +const GitRepositoryKind = "GitRepository" + // GitRepositorySpec defines the desired state of a Git repository. type GitRepositorySpec struct { // The repository URL, can be a HTTP or SSH address. diff --git a/api/v1alpha1/helmchart_types.go b/api/v1alpha1/helmchart_types.go index 55851787..03abf07e 100644 --- a/api/v1alpha1/helmchart_types.go +++ b/api/v1alpha1/helmchart_types.go @@ -21,6 +21,8 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) +const HelmChartKind = "HelmChart" + // HelmChartSpec defines the desired state of a Helm chart. type HelmChartSpec struct { // The name of the Helm chart, as made available by the referenced diff --git a/api/v1alpha1/helmrepository_types.go b/api/v1alpha1/helmrepository_types.go index d724d932..6566ddf4 100644 --- a/api/v1alpha1/helmrepository_types.go +++ b/api/v1alpha1/helmrepository_types.go @@ -21,6 +21,8 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) +const HelmRepositoryKind = "HelmRepository" + // HelmRepositorySpec defines the reference to a Helm repository. type HelmRepositorySpec struct { // The Helm repository URL, a valid URL contains at least a diff --git a/controllers/suite_test.go b/controllers/suite_test.go index 148ccc92..cf03612b 100644 --- a/controllers/suite_test.go +++ b/controllers/suite_test.go @@ -107,7 +107,7 @@ var _ = BeforeSuite(func(done Done) { err = (&GitRepositoryReconciler{ Client: k8sManager.GetClient(), - Log: ctrl.Log.WithName("controllers").WithName("GitRepository"), + Log: ctrl.Log.WithName("controllers").WithName(sourcev1.GitRepositoryKind), Scheme: scheme.Scheme, Storage: storage, }).SetupWithManager(k8sManager) @@ -115,7 +115,7 @@ var _ = BeforeSuite(func(done Done) { err = (&HelmRepositoryReconciler{ Client: k8sManager.GetClient(), - Log: ctrl.Log.WithName("controllers").WithName("HelmRepository"), + Log: ctrl.Log.WithName("controllers").WithName(sourcev1.HelmRepositoryKind), Scheme: scheme.Scheme, Storage: storage, Getters: getter.Providers{getter.Provider{ @@ -127,7 +127,7 @@ var _ = BeforeSuite(func(done Done) { err = (&HelmChartReconciler{ Client: k8sManager.GetClient(), - Log: ctrl.Log.WithName("controllers").WithName("HelmChart"), + Log: ctrl.Log.WithName("controllers").WithName(sourcev1.HelmChartKind), Scheme: scheme.Scheme, Storage: storage, Getters: getter.Providers{getter.Provider{ diff --git a/main.go b/main.go index 9d4eea22..f7513bb0 100644 --- a/main.go +++ b/main.go @@ -112,7 +112,7 @@ func main() { if err = (&controllers.GitRepositoryReconciler{ Client: mgr.GetClient(), - Log: ctrl.Log.WithName("controllers").WithName("GitRepository"), + Log: ctrl.Log.WithName("controllers").WithName(sourcev1.GitRepositoryKind), Scheme: mgr.GetScheme(), Storage: storage, EventRecorder: mgr.GetEventRecorderFor("source-controller"), @@ -120,12 +120,12 @@ func main() { }).SetupWithManagerAndOptions(mgr, controllers.GitRepositoryReconcilerOptions{ MaxConcurrentReconciles: concurrent, }); err != nil { - setupLog.Error(err, "unable to create controller", "controller", "GitRepository") + setupLog.Error(err, "unable to create controller", "controller", sourcev1.GitRepositoryKind) os.Exit(1) } if err = (&controllers.HelmRepositoryReconciler{ Client: mgr.GetClient(), - Log: ctrl.Log.WithName("controllers").WithName("HelmRepository"), + Log: ctrl.Log.WithName("controllers").WithName(sourcev1.HelmRepositoryKind), Scheme: mgr.GetScheme(), Storage: storage, Getters: getters, @@ -134,12 +134,12 @@ func main() { }).SetupWithManagerAndOptions(mgr, controllers.HelmRepositoryReconcilerOptions{ MaxConcurrentReconciles: concurrent, }); err != nil { - setupLog.Error(err, "unable to create controller", "controller", "HelmRepository") + setupLog.Error(err, "unable to create controller", "controller", sourcev1.HelmRepositoryKind) os.Exit(1) } if err = (&controllers.HelmChartReconciler{ Client: mgr.GetClient(), - Log: ctrl.Log.WithName("controllers").WithName("HelmChart"), + Log: ctrl.Log.WithName("controllers").WithName(sourcev1.HelmChartKind), Scheme: mgr.GetScheme(), Storage: storage, Getters: getters, @@ -148,7 +148,7 @@ func main() { }).SetupWithManagerAndOptions(mgr, controllers.HelmChartReconcilerOptions{ MaxConcurrentReconciles: concurrent, }); err != nil { - setupLog.Error(err, "unable to create controller", "controller", "HelmChart") + setupLog.Error(err, "unable to create controller", "controller", sourcev1.HelmChartKind) os.Exit(1) } // +kubebuilder:scaffold:builder