Skip to content

Commit

Permalink
Properly handle delete event
Browse files Browse the repository at this point in the history
  • Loading branch information
roothorp committed Aug 8, 2023
1 parent e64418c commit b472b40
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
k8serrors "k8s.io/apimachinery/pkg/api/errors"
"sigs.k8s.io/controller-runtime/pkg/builder"
"sigs.k8s.io/controller-runtime/pkg/event"
"sigs.k8s.io/controller-runtime/pkg/source"

"github.com/mongodb/mongodb-atlas-kubernetes/pkg/controller/connectionsecret"

Expand Down Expand Up @@ -223,6 +224,7 @@ func (r *AtlasDataFederationReconciler) readProjectResource(ctx context.Context,
func (r *AtlasDataFederationReconciler) SetupWithManager(mgr ctrl.Manager) error {
return ctrl.NewControllerManagedBy(mgr).
Named("AtlasDataFederation").
Watches(&source.Kind{Type: &mdbv1.AtlasDataFederation{}}, &watch.EventHandlerWithDelete{Controller: r}, builder.WithPredicates(r.GlobalPredicates...)).
For(&mdbv1.AtlasDataFederation{}, builder.WithPredicates(r.GlobalPredicates...)).
Complete(r)
}
Expand Down

0 comments on commit b472b40

Please sign in to comment.