Skip to content

Commit ce43486

Browse files
committed
controller: sched: use current resource status as base for updated
syncNUMASchedulerResources() is constructing the sched status and later in the reconcile loop this status is overriding the main instance status. Concerning status conditions, the only situation where the conditions are not set is on first creation of the scheduler CR, the rest of the cases the conditions are there but they are continuously overridden with nil in syncNUMASchedulerResources(). This in turn leads to updating the conditions in r.updateStatus() whenever it is invoked regardless of the actual existing conditions. In this commit, ensure that the original current status is the base of the new one. Signed-off-by: Shereen Haj <[email protected]> (cherry picked from commit f3893f3)
1 parent 4ecc5db commit ce43486

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

internal/controller/numaresourcesscheduler_controller.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,10 @@ func (r *NUMAResourcesSchedulerReconciler) syncNUMASchedulerResources(ctx contex
216216
return nropv1.NUMAResourcesSchedulerStatus{}, err
217217
}
218218

219-
schedStatus := nropv1.NUMAResourcesSchedulerStatus{
220-
SchedulerName: schedSpec.SchedulerName,
221-
CacheResyncPeriod: &metav1.Duration{
222-
Duration: cacheResyncPeriod,
223-
},
219+
schedStatus := *instance.Status.DeepCopy()
220+
schedStatus.SchedulerName = schedSpec.SchedulerName
221+
schedStatus.CacheResyncPeriod = &metav1.Duration{
222+
Duration: cacheResyncPeriod,
224223
}
225224

226225
r.SchedulerManifests.Deployment.Spec.Replicas = r.computeSchedulerReplicas(schedSpec)

0 commit comments

Comments
 (0)