Skip to content

Commit d35c258

Browse files
authored
Merge pull request #82 from fluxcd/api/kind-constants
2 parents 9592196 + c90be06 commit d35c258

File tree

5 files changed

+15
-9
lines changed

5 files changed

+15
-9
lines changed

api/v1alpha1/gitrepository_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import (
2323
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2424
)
2525

26+
const GitRepositoryKind = "GitRepository"
27+
2628
// GitRepositorySpec defines the desired state of a Git repository.
2729
type GitRepositorySpec struct {
2830
// The repository URL, can be a HTTP or SSH address.

api/v1alpha1/helmchart_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ import (
2121
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2222
)
2323

24+
const HelmChartKind = "HelmChart"
25+
2426
// HelmChartSpec defines the desired state of a Helm chart.
2527
type HelmChartSpec struct {
2628
// The name of the Helm chart, as made available by the referenced

api/v1alpha1/helmrepository_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ import (
2121
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2222
)
2323

24+
const HelmRepositoryKind = "HelmRepository"
25+
2426
// HelmRepositorySpec defines the reference to a Helm repository.
2527
type HelmRepositorySpec struct {
2628
// The Helm repository URL, a valid URL contains at least a

controllers/suite_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,15 @@ var _ = BeforeSuite(func(done Done) {
107107

108108
err = (&GitRepositoryReconciler{
109109
Client: k8sManager.GetClient(),
110-
Log: ctrl.Log.WithName("controllers").WithName("GitRepository"),
110+
Log: ctrl.Log.WithName("controllers").WithName(sourcev1.GitRepositoryKind),
111111
Scheme: scheme.Scheme,
112112
Storage: storage,
113113
}).SetupWithManager(k8sManager)
114114
Expect(err).ToNot(HaveOccurred(), "failed to setup GtRepositoryReconciler")
115115

116116
err = (&HelmRepositoryReconciler{
117117
Client: k8sManager.GetClient(),
118-
Log: ctrl.Log.WithName("controllers").WithName("HelmRepository"),
118+
Log: ctrl.Log.WithName("controllers").WithName(sourcev1.HelmRepositoryKind),
119119
Scheme: scheme.Scheme,
120120
Storage: storage,
121121
Getters: getter.Providers{getter.Provider{
@@ -127,7 +127,7 @@ var _ = BeforeSuite(func(done Done) {
127127

128128
err = (&HelmChartReconciler{
129129
Client: k8sManager.GetClient(),
130-
Log: ctrl.Log.WithName("controllers").WithName("HelmChart"),
130+
Log: ctrl.Log.WithName("controllers").WithName(sourcev1.HelmChartKind),
131131
Scheme: scheme.Scheme,
132132
Storage: storage,
133133
Getters: getter.Providers{getter.Provider{

main.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,20 +112,20 @@ func main() {
112112

113113
if err = (&controllers.GitRepositoryReconciler{
114114
Client: mgr.GetClient(),
115-
Log: ctrl.Log.WithName("controllers").WithName("GitRepository"),
115+
Log: ctrl.Log.WithName("controllers").WithName(sourcev1.GitRepositoryKind),
116116
Scheme: mgr.GetScheme(),
117117
Storage: storage,
118118
EventRecorder: mgr.GetEventRecorderFor("source-controller"),
119119
ExternalEventRecorder: eventRecorder,
120120
}).SetupWithManagerAndOptions(mgr, controllers.GitRepositoryReconcilerOptions{
121121
MaxConcurrentReconciles: concurrent,
122122
}); err != nil {
123-
setupLog.Error(err, "unable to create controller", "controller", "GitRepository")
123+
setupLog.Error(err, "unable to create controller", "controller", sourcev1.GitRepositoryKind)
124124
os.Exit(1)
125125
}
126126
if err = (&controllers.HelmRepositoryReconciler{
127127
Client: mgr.GetClient(),
128-
Log: ctrl.Log.WithName("controllers").WithName("HelmRepository"),
128+
Log: ctrl.Log.WithName("controllers").WithName(sourcev1.HelmRepositoryKind),
129129
Scheme: mgr.GetScheme(),
130130
Storage: storage,
131131
Getters: getters,
@@ -134,12 +134,12 @@ func main() {
134134
}).SetupWithManagerAndOptions(mgr, controllers.HelmRepositoryReconcilerOptions{
135135
MaxConcurrentReconciles: concurrent,
136136
}); err != nil {
137-
setupLog.Error(err, "unable to create controller", "controller", "HelmRepository")
137+
setupLog.Error(err, "unable to create controller", "controller", sourcev1.HelmRepositoryKind)
138138
os.Exit(1)
139139
}
140140
if err = (&controllers.HelmChartReconciler{
141141
Client: mgr.GetClient(),
142-
Log: ctrl.Log.WithName("controllers").WithName("HelmChart"),
142+
Log: ctrl.Log.WithName("controllers").WithName(sourcev1.HelmChartKind),
143143
Scheme: mgr.GetScheme(),
144144
Storage: storage,
145145
Getters: getters,
@@ -148,7 +148,7 @@ func main() {
148148
}).SetupWithManagerAndOptions(mgr, controllers.HelmChartReconcilerOptions{
149149
MaxConcurrentReconciles: concurrent,
150150
}); err != nil {
151-
setupLog.Error(err, "unable to create controller", "controller", "HelmChart")
151+
setupLog.Error(err, "unable to create controller", "controller", sourcev1.HelmChartKind)
152152
os.Exit(1)
153153
}
154154
// +kubebuilder:scaffold:builder

0 commit comments

Comments
 (0)