@@ -120,9 +120,17 @@ func (r *ComponentBuildReconciler) SetupWithManager(mgr ctrl.Manager) error {
120120 return true
121121 },
122122 UpdateFunc : func (e event.UpdateEvent ) bool {
123- // Only reconcile when spec changes (Generation increments), not on status-only updates
124- // This might prevent scheduled (daily) reconcile to be triggered (but we shouldn't need it)
125- return e .ObjectOld .GetGeneration () != e .ObjectNew .GetGeneration ()
123+ component , ok := e .ObjectNew .(* applicationapiv1alpha1.Component )
124+ if ! ok {
125+ return false
126+ }
127+
128+ // For new model: only reconcile when spec changes (Generation increments), not on status-only updates
129+ // For old model: always reconcile on update (old model uses annotations which don't increment Generation)
130+ if isComponentUsingNewModel (component ) {
131+ return e .ObjectOld .GetGeneration () != e .ObjectNew .GetGeneration ()
132+ }
133+ return true
126134 },
127135 DeleteFunc : func (e event.DeleteEvent ) bool {
128136 return false
@@ -135,6 +143,13 @@ func (r *ComponentBuildReconciler) SetupWithManager(mgr ctrl.Manager) error {
135143 Complete (r )
136144}
137145
146+ // isComponentUsingNewModel checks if the component is configured to use the new model (v2).
147+ // Returns true if the component has the new model annotation set to v2 or if the default model is v2.
148+ func isComponentUsingNewModel (component * applicationapiv1alpha1.Component ) bool {
149+ requestedModel , requestedModelAnnotationExists := component .Annotations [ComponentModelVersionAnnotation ]
150+ return (requestedModelAnnotationExists && requestedModel == NewComponentModelVersion ) || DefaultComponentModelVersion == NewComponentModelVersion
151+ }
152+
138153func updateMetricsTimes (componentIdForMetrics string , requestedAction string , reconcileStartTime time.Time ) {
139154 componentInfo , timeRecorded := bometrics .ComponentTimesForMetrics [componentIdForMetrics ]
140155
@@ -185,8 +200,7 @@ func (r *ComponentBuildReconciler) Reconcile(ctx context.Context, req ctrl.Reque
185200 return ctrl.Result {}, err
186201 }
187202
188- requestedModel , requestedModelAnnotationExists := component .Annotations [ComponentModelVersionAnnotation ]
189- if (requestedModelAnnotationExists && requestedModel == NewComponentModelVersion ) || DefaultComponentModelVersion == NewComponentModelVersion {
203+ if isComponentUsingNewModel (& component ) {
190204 return r .ReconcileNewModel (ctx , req )
191205 }
192206
0 commit comments