Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions internal/controller/atlasthirdpartyintegrations/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,23 +78,20 @@ func NewAtlasThirdPartyIntegrationsReconciler(

// For prepares the controller for its target Custom Resource; AtlasThirdPartyIntegration
func (r *AtlasThirdPartyIntegrationHandler) For() (client.Object, builder.Predicates) {
return &akov2.AtlasThirdPartyIntegration{}, builder.WithPredicates(predicate.GenerationChangedPredicate{})
obj := &akov2.AtlasThirdPartyIntegration{}
return obj, ctrlrtbuilder.WithPredicates(
Comment on lines +81 to +82
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: obj is not required right?

Suggested change
obj := &akov2.AtlasThirdPartyIntegration{}
return obj, ctrlrtbuilder.WithPredicates(
return &akov2.AtlasThirdPartyIntegration{}, ctrlrtbuilder.WithPredicates(

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, copy-pasta

predicate.Or(
mckpredicate.AnnotationChanged("mongodb.com/reapply-period"),
predicate.GenerationChangedPredicate{},
),
mckpredicate.IgnoreDeletedPredicate[client.Object](),
)
}

func (h *AtlasThirdPartyIntegrationHandler) SetupWithManager(mgr ctrl.Manager, rec reconcile.Reconciler, defaultOptions controller.Options) error {
h.Client = mgr.GetClient()
obj := &akov2.AtlasThirdPartyIntegration{}
return controllerruntime.NewControllerManagedBy(mgr).
For(
obj,
ctrlrtbuilder.WithPredicates(
predicate.Or(
mckpredicate.AnnotationChanged("mongodb.com/reapply-period"),
predicate.GenerationChangedPredicate{},
),
mckpredicate.IgnoreDeletedPredicate[client.Object](),
),
).
For(h.For()).
Watches(
&akov2.AtlasProject{},
handler.EnqueueRequestsFromMapFunc(h.integrationForProjectMapFunc()),
Expand Down
Loading