Skip to content

Commit

Permalink
fixup! fixup! refactor: updated IP controller for new ipam
Browse files Browse the repository at this point in the history
  • Loading branch information
fra98 committed Nov 15, 2024
1 parent cffe693 commit 81689fa
Showing 1 changed file with 1 addition and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,10 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/klog/v2"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/builder"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/controller"
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
"sigs.k8s.io/controller-runtime/pkg/event"
"sigs.k8s.io/controller-runtime/pkg/handler"
"sigs.k8s.io/controller-runtime/pkg/predicate"
"sigs.k8s.io/controller-runtime/pkg/reconcile"

ipamv1alpha1 "github.com/liqotech/liqo/apis/ipam/v1alpha1"
Expand Down Expand Up @@ -167,20 +164,11 @@ func (r *IPReconciler) SetupWithManager(mgr ctrl.Manager, workers int) error {
For(&ipamv1alpha1.IP{}).
Owns(&v1.Service{}).
Owns(&discoveryv1.EndpointSlice{}).
Watches(&ipamv1alpha1.Network{},
handler.EnqueueRequestsFromMapFunc(r.ipEnqueuerFromNetwork),
builder.WithPredicates(nwPredicates)).
Watches(&ipamv1alpha1.Network{}, handler.EnqueueRequestsFromMapFunc(r.ipEnqueuerFromNetwork)).
WithOptions(controller.Options{MaxConcurrentReconciles: workers}).
Complete(r)
}

var nwPredicates = predicate.Funcs{
CreateFunc: func(_ event.CreateEvent) bool { return false },
UpdateFunc: func(_ event.UpdateEvent) bool { return false },
DeleteFunc: func(_ event.DeleteEvent) bool { return true },
GenericFunc: func(_ event.GenericEvent) bool { return false },
}

func (r *IPReconciler) ipEnqueuerFromNetwork(ctx context.Context, obj client.Object) []ctrl.Request {
var requests []reconcile.Request

Expand Down

0 comments on commit 81689fa

Please sign in to comment.