File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
pkg/controllers/execution Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ import (
3636 "sigs.k8s.io/controller-runtime/pkg/client"
3737 "sigs.k8s.io/controller-runtime/pkg/controller"
3838 "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
39+ "sigs.k8s.io/controller-runtime/pkg/event"
3940 "sigs.k8s.io/controller-runtime/pkg/predicate"
4041
4142 clusterv1alpha1 "github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1"
@@ -139,10 +140,15 @@ func (c *Controller) SetupWithManager(mgr controllerruntime.Manager) error {
139140 RateLimiter : ratelimiterflag.DefaultControllerRateLimiter [controllerruntime.Request ](c .RateLimiterOptions ),
140141 })
141142
143+ // Ignore delete events; the deletion process will be handled by the deletion timestamp set.
144+ deleteIgnorePred := predicate.Funcs {
145+ DeleteFunc : func (event.DeleteEvent ) bool { return false },
146+ }
147+
142148 if c .WorkPredicateFunc != nil {
143- ctrlBuilder .For (& workv1alpha1.Work {}, builder .WithPredicates (c .WorkPredicateFunc ))
149+ ctrlBuilder .For (& workv1alpha1.Work {}, builder .WithPredicates (c .WorkPredicateFunc , deleteIgnorePred ))
144150 } else {
145- ctrlBuilder .For (& workv1alpha1.Work {})
151+ ctrlBuilder .For (& workv1alpha1.Work {}, builder . WithPredicates ( deleteIgnorePred ) )
146152 }
147153
148154 return ctrlBuilder .Complete (c )
You can’t perform that action at this time.
0 commit comments