@@ -22,6 +22,7 @@ import (
2222 "time"
2323
2424 "github.com/NVIDIA/k8s-operator-libs/pkg/upgrade"
25+ "github.com/go-logr/logr"
2526 appsv1 "k8s.io/api/apps/v1"
2627 corev1 "k8s.io/api/core/v1"
2728 "k8s.io/apimachinery/pkg/api/errors"
@@ -194,8 +195,7 @@ func (r *UpgradeReconciler) removeNodeUpgradeStateAnnotations(ctx context.Contex
194195// SetupWithManager sets up the controller with the Manager.
195196//
196197//nolint:dupl
197- func (r * UpgradeReconciler ) SetupWithManager (mgr ctrl.Manager ,
198- requestorPredicate upgrade.ConditionChangedPredicate ) error {
198+ func (r * UpgradeReconciler ) SetupWithManager (log logr.Logger , mgr ctrl.Manager ) error {
199199 // we always add object with a same(static) key to the queue to reduce
200200 // reconciliation count
201201 qHandler := func (q workqueue.TypedRateLimitingInterface [reconcile.Request ]) {
@@ -231,7 +231,7 @@ func (r *UpgradeReconciler) SetupWithManager(mgr ctrl.Manager,
231231 labels := object .GetLabels ()
232232 _ , ok := labels [consts .OfedDriverLabel ]
233233 return ok
234- }), requestorPredicate )
234+ }))
235235
236236 // react only on label and annotation changes
237237 nodePredicates := builder .WithPredicates (
@@ -252,8 +252,12 @@ func (r *UpgradeReconciler) SetupWithManager(mgr ctrl.Manager,
252252 // Conditionally add Watches for NodeMaintenance if UseMaintenanceOperator is true
253253 requestorOpts := upgrade .GetRequestorOptsFromEnvs ()
254254 if requestorOpts .UseMaintenanceOperator {
255+ nodeMaintenancePredicate := upgrade .NewConditionChangedPredicate (log ,
256+ requestorOpts .MaintenanceOPRequestorID )
257+ requestorIDPredicate := upgrade .NewRequestorIDPredicate (log ,
258+ requestorOpts .MaintenanceOPRequestorID )
255259 mngr = mngr .Watches (& maintenancev1alpha1.NodeMaintenance {}, createUpdateDeleteEnqueue ,
256- builder .WithPredicates (requestorPredicate ))
260+ builder .WithPredicates (nodeMaintenancePredicate , requestorIDPredicate ))
257261 }
258262
259263 return mngr .Complete (r )
0 commit comments