Skip to content

Commit

Permalink
fix: add label changed predicate for node obj in upgrade controller
Browse files Browse the repository at this point in the history
This change is needed because common upgrade lib is using both labels and annotations to store upgrade state.
This change increase performance of the upgrade controller.

Signed-off-by: Yury Kulazhenkov <[email protected]>
  • Loading branch information
ykulazhenkov committed Dec 12, 2023
1 parent e68cb5a commit c85a009
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions controllers/upgrade_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,10 @@ func (r *UpgradeReconciler) SetupWithManager(mgr ctrl.Manager) error {
return ok
}))

// Watch for spec and annotation changes
nodePredicates := builder.WithPredicates(predicate.AnnotationChangedPredicate{})
// react only on label and annotation changes
nodePredicates := builder.WithPredicates(
predicate.Or(predicate.AnnotationChangedPredicate{},
predicate.LabelChangedPredicate{}))

return ctrl.NewControllerManagedBy(mgr).
For(&mellanoxv1alpha1.NicClusterPolicy{}).
Expand Down

0 comments on commit c85a009

Please sign in to comment.