Skip to content

Commit d4830bc

Browse files
authored
Merge pull request #137 from fluxcd/use-pkg-for-runtime-bits
Use pkg/runtime for predicate and logger
2 parents 783892b + 901463e commit d4830bc

File tree

8 files changed

+10
-67
lines changed

8 files changed

+10
-67
lines changed

api/v1alpha1/source.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@ type Source interface {
1414
GetInterval() metav1.Duration
1515
}
1616

17-
const (
18-
// ReconcileAtAnnotation is the annotation used for triggering a
19-
// reconciliation outside of the defined schedule.
20-
ReconcileAtAnnotation string = "fluxcd.io/reconcileAt"
21-
)
22-
2317
// filterOutSourceCondition returns a new SourceCondition slice without the
2418
// SourceCondition of the given type.
2519
func filterOutSourceCondition(conditions []SourceCondition, condition string) []SourceCondition {

controllers/gitrepository_controller.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import (
3838
"sigs.k8s.io/controller-runtime/pkg/controller"
3939

4040
"github.com/fluxcd/pkg/recorder"
41+
"github.com/fluxcd/pkg/runtime/predicates"
4142

4243
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
4344
"github.com/fluxcd/source-controller/pkg/git"
@@ -158,7 +159,7 @@ func (r *GitRepositoryReconciler) SetupWithManager(mgr ctrl.Manager) error {
158159
func (r *GitRepositoryReconciler) SetupWithManagerAndOptions(mgr ctrl.Manager, opts GitRepositoryReconcilerOptions) error {
159160
return ctrl.NewControllerManagedBy(mgr).
160161
For(&sourcev1.GitRepository{}).
161-
WithEventFilter(SourceChangePredicate{}).
162+
WithEventFilter(predicates.ChangePredicate{}).
162163
WithOptions(controller.Options{MaxConcurrentReconciles: opts.MaxConcurrentReconciles}).
163164
Complete(r)
164165
}

controllers/helmchart_controller.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import (
4141
"sigs.k8s.io/controller-runtime/pkg/controller"
4242

4343
"github.com/fluxcd/pkg/recorder"
44+
"github.com/fluxcd/pkg/runtime/predicates"
4445
"github.com/fluxcd/pkg/untar"
4546

4647
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
@@ -181,7 +182,7 @@ func (r *HelmChartReconciler) SetupWithManager(mgr ctrl.Manager) error {
181182
func (r *HelmChartReconciler) SetupWithManagerAndOptions(mgr ctrl.Manager, opts HelmChartReconcilerOptions) error {
182183
return ctrl.NewControllerManagedBy(mgr).
183184
For(&sourcev1.HelmChart{}).
184-
WithEventFilter(SourceChangePredicate{}).
185+
WithEventFilter(predicates.ChangePredicate{}).
185186
WithOptions(controller.Options{MaxConcurrentReconciles: opts.MaxConcurrentReconciles}).
186187
Complete(r)
187188
}

controllers/helmrepository_controller.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import (
4040
"sigs.k8s.io/yaml"
4141

4242
"github.com/fluxcd/pkg/recorder"
43+
"github.com/fluxcd/pkg/runtime/predicates"
4344
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
4445
"github.com/fluxcd/source-controller/internal/helm"
4546
)
@@ -160,7 +161,7 @@ func (r *HelmRepositoryReconciler) SetupWithManager(mgr ctrl.Manager) error {
160161
func (r *HelmRepositoryReconciler) SetupWithManagerAndOptions(mgr ctrl.Manager, opts HelmRepositoryReconcilerOptions) error {
161162
return ctrl.NewControllerManagedBy(mgr).
162163
For(&sourcev1.HelmRepository{}).
163-
WithEventFilter(SourceChangePredicate{}).
164+
WithEventFilter(predicates.ChangePredicate{}).
164165
WithOptions(controller.Options{MaxConcurrentReconciles: opts.MaxConcurrentReconciles}).
165166
Complete(r)
166167
}

controllers/predicate.go

Lines changed: 0 additions & 54 deletions
This file was deleted.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ require (
99
github.com/fluxcd/pkg/gittestserver v0.0.2
1010
github.com/fluxcd/pkg/helmtestserver v0.0.1
1111
github.com/fluxcd/pkg/lockedfile v0.0.5
12-
github.com/fluxcd/pkg/logger v0.0.1
1312
github.com/fluxcd/pkg/recorder v0.0.6
13+
github.com/fluxcd/pkg/runtime v0.0.0-20200909163337-e7e634246495
1414
github.com/fluxcd/pkg/ssh v0.0.5
1515
github.com/fluxcd/pkg/untar v0.0.5
1616
github.com/fluxcd/source-controller/api v0.0.14

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,10 @@ github.com/fluxcd/pkg/helmtestserver v0.0.1 h1:8RcLZdg7Zr9ZqyijsIIASjjMXQtF4UWP4
208208
github.com/fluxcd/pkg/helmtestserver v0.0.1/go.mod h1:GR8LriiU7PqZSTH4Xe6Cimpig2VVPB29PeUXJjNJYfA=
209209
github.com/fluxcd/pkg/lockedfile v0.0.5 h1:C3T8wfdff1UY1bvplmCkGOLrdMWJHO8Q8+tdlEXJYzQ=
210210
github.com/fluxcd/pkg/lockedfile v0.0.5/go.mod h1:uAtPUBId6a2RqO84MTH5HKGX0SbM1kNW3Wr/FhYyDVA=
211-
github.com/fluxcd/pkg/logger v0.0.1 h1:YInMzE4w+crIHQcUI4uLgFI0J+D0IVb8+pgYrseAYNY=
212-
github.com/fluxcd/pkg/logger v0.0.1/go.mod h1:Qg+nqSAmY6OyO9JAIfQr0J2LjNu++M1Sm7KcZVLnjDM=
213211
github.com/fluxcd/pkg/recorder v0.0.6 h1:me/n8syeeGXz50OXoPX3jgIj9AtinvhHdKT9Dy+MbHs=
214212
github.com/fluxcd/pkg/recorder v0.0.6/go.mod h1:IfQxfVRSNsWs3B0Yp5B6ObEWwKHILlAx8N7XkoDdhFg=
213+
github.com/fluxcd/pkg/runtime v0.0.0-20200909163337-e7e634246495 h1:zhtLz8iRtJWK+jKq9vi9Si4QbcAC2KvQZpQ55DRzLsU=
214+
github.com/fluxcd/pkg/runtime v0.0.0-20200909163337-e7e634246495/go.mod h1:cU1t0+Ld39pZjMyrrHukw1E++OZFNHxG2qAExfDWQ34=
215215
github.com/fluxcd/pkg/ssh v0.0.5 h1:rnbFZ7voy2JBlUfMbfyqArX2FYaLNpDhccGFC3qW83A=
216216
github.com/fluxcd/pkg/ssh v0.0.5/go.mod h1:7jXPdXZpc0ttMNz2kD9QuMi3RNn/e0DOFbj0Tij/+Hs=
217217
github.com/fluxcd/pkg/testserver v0.0.2 h1:SoaMtO9cE5p/wl2zkGudzflnEHd9mk68CGjZOo7w0Uk=

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ import (
3333
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
3434
ctrl "sigs.k8s.io/controller-runtime"
3535

36-
"github.com/fluxcd/pkg/logger"
3736
"github.com/fluxcd/pkg/recorder"
37+
"github.com/fluxcd/pkg/runtime/logger"
3838
sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1"
3939
"github.com/fluxcd/source-controller/controllers"
4040
// +kubebuilder:scaffold:imports

0 commit comments

Comments
 (0)