Skip to content

Commit bfcbfff

Browse files
authored
add For method in controller (#2415)
1 parent 39fc3a0 commit bfcbfff

File tree

1 file changed

+9
-12
lines changed
  • internal/controller/atlasthirdpartyintegrations

1 file changed

+9
-12
lines changed

internal/controller/atlasthirdpartyintegrations/setup.go

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -78,23 +78,20 @@ func NewAtlasThirdPartyIntegrationsReconciler(
7878

7979
// For prepares the controller for its target Custom Resource; AtlasThirdPartyIntegration
8080
func (r *AtlasThirdPartyIntegrationHandler) For() (client.Object, builder.Predicates) {
81-
return &akov2.AtlasThirdPartyIntegration{}, builder.WithPredicates(predicate.GenerationChangedPredicate{})
81+
obj := &akov2.AtlasThirdPartyIntegration{}
82+
return obj, ctrlrtbuilder.WithPredicates(
83+
predicate.Or(
84+
mckpredicate.AnnotationChanged("mongodb.com/reapply-period"),
85+
predicate.GenerationChangedPredicate{},
86+
),
87+
mckpredicate.IgnoreDeletedPredicate[client.Object](),
88+
)
8289
}
8390

8491
func (h *AtlasThirdPartyIntegrationHandler) SetupWithManager(mgr ctrl.Manager, rec reconcile.Reconciler, defaultOptions controller.Options) error {
8592
h.Client = mgr.GetClient()
86-
obj := &akov2.AtlasThirdPartyIntegration{}
8793
return controllerruntime.NewControllerManagedBy(mgr).
88-
For(
89-
obj,
90-
ctrlrtbuilder.WithPredicates(
91-
predicate.Or(
92-
mckpredicate.AnnotationChanged("mongodb.com/reapply-period"),
93-
predicate.GenerationChangedPredicate{},
94-
),
95-
mckpredicate.IgnoreDeletedPredicate[client.Object](),
96-
),
97-
).
94+
For(h.For()).
9895
Watches(
9996
&akov2.AtlasProject{},
10097
handler.EnqueueRequestsFromMapFunc(h.integrationForProjectMapFunc()),

0 commit comments

Comments
 (0)