@@ -131,6 +131,7 @@ func (r *ComponentRegistry) Register(component ComponentReconciler) {
131131func (r * ComponentRegistry ) ReconcileComponents (ctx context.Context , params * ReconcileComponentParams ) (reconcile.Result , error ) {
132132 var result reconcile.Result
133133 now := metav1 .NewTime (time .Now ())
134+ hasConflict := false
134135
135136 for _ , comp := range r .components {
136137 // Check if component is enabled and if there's a conflict
@@ -142,6 +143,7 @@ func (r *ComponentRegistry) ReconcileComponents(ctx context.Context, params *Rec
142143 if ! enabled {
143144 // Component is disabled, clean it up
144145 if conflict {
146+ hasConflict = true
145147 // Set conflict status condition
146148 condition .UpdateDatadogAgentInternalStatusConditions (
147149 params .Status ,
@@ -155,7 +157,6 @@ func (r *ComponentRegistry) ReconcileComponents(ctx context.Context, params *Rec
155157 }
156158 res , err = r .Cleanup (ctx , params , comp )
157159 } else {
158- // Component is enabled, reconcile it
159160 res , err = r .reconcileComponent (ctx , params , comp )
160161 }
161162
@@ -169,6 +170,13 @@ func (r *ComponentRegistry) ReconcileComponents(ctx context.Context, params *Rec
169170 }
170171 }
171172
173+ // Clear conflict condition only after all components are processed and none has a conflict.
174+ // This prevents prematurely removing the condition when a later component is enabled
175+ // but an earlier one still has a conflict.
176+ if ! hasConflict {
177+ condition .DeleteDatadogAgentInternalStatusCondition (params .Status , common .OverrideReconcileConflictConditionType )
178+ }
179+
172180 return result , nil
173181}
174182
0 commit comments