Skip to content

Commit 0f16ebf

Browse files
committed
Only reconcile on spec updates
1 parent f9e2958 commit 0f16ebf

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

internal/controller/function_controller.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import (
3636
ctrl "sigs.k8s.io/controller-runtime"
3737
"sigs.k8s.io/controller-runtime/pkg/client"
3838
logf "sigs.k8s.io/controller-runtime/pkg/log"
39+
"sigs.k8s.io/controller-runtime/pkg/predicate"
3940

4041
"github.com/creydr/func-operator/api/v1alpha1"
4142
rbacv1 "k8s.io/api/rbac/v1"
@@ -312,6 +313,7 @@ func (r *FunctionReconciler) deployedImage(ctx context.Context, name, namespace
312313
func (r *FunctionReconciler) SetupWithManager(mgr ctrl.Manager) error {
313314
return ctrl.NewControllerManagedBy(mgr).
314315
For(&v1alpha1.Function{}).
316+
WithEventFilter(predicate.GenerationChangedPredicate{}). // only reconcile when the spec changed (e.g. not on status updates)
315317
Named("function").
316318
Complete(r)
317319
}

0 commit comments

Comments
 (0)