Skip to content

Commit

Permalink
WIP 2
Browse files Browse the repository at this point in the history
Signed-off-by: Francesco Romani <fromani@redhat.com>
  • Loading branch information
ffromani committed Oct 9, 2024
1 parent 1f25477 commit 4cb9131
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions controllers/numaresourcesoperator_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,7 @@ func (r *NUMAResourcesOperatorReconciler) Reconcile(ctx context.Context, req ctr

curStatus := instance.Status.DeepCopy()

result, condition, err := r.reconcileResource(ctx, instance, trees)

_ = updateStatusConditionsIfNeeded(instance, condition, reasonFromError(err), messageFromError(err))
result, err := r.reconcileResource(ctx, instance, trees)

if !status.IsUpdatedNUMAResourcesOperator(curStatus, &instance.Status) {
return result, err
Expand Down Expand Up @@ -262,22 +260,26 @@ func (r *NUMAResourcesOperatorReconciler) reconcileResourceDaemonSet(ctx context
return false, ctrl.Result{}, "", nil
}

func (r *NUMAResourcesOperatorReconciler) reconcileResource(ctx context.Context, instance *nropv1.NUMAResourcesOperator, trees []nodegroupv1.Tree) (ctrl.Result, string, error) {
func (r *NUMAResourcesOperatorReconciler) reconcileResource(ctx context.Context, instance *nropv1.NUMAResourcesOperator, trees []nodegroupv1.Tree) (ctrl.Result, error) {
if done, res, cond, err := r.reconcileResourceAPI(ctx, instance, trees); done {
return res, cond, err
_ = updateStatusConditionsIfNeeded(instance, cond, reasonFromError(err), messageFromError(err))
return res, err
}

if r.Platform == platform.OpenShift {
if done, res, cond, err := r.reconcileResourceMachineConfig(ctx, instance, trees); done {
return res, cond, err
_ = updateStatusConditionsIfNeeded(instance, cond, reasonFromError(err), messageFromError(err))
return res, err
}
}

if done, res, cond, err := r.reconcileResourceDaemonSet(ctx, instance, trees); done {
return res, cond, err
_ = updateStatusConditionsIfNeeded(instance, cond, reasonFromError(err), messageFromError(err))
return res, err
}

return ctrl.Result{}, status.ConditionAvailable, nil
_ = updateStatusConditionsIfNeeded(instance, status.ConditionAvailable, reasonFromError(nil), messageFromError(nil))
return ctrl.Result{}, nil
}

func (r *NUMAResourcesOperatorReconciler) syncDaemonSetsStatuses(ctx context.Context, rd client.Reader, daemonSetsInfo []nropv1.NamespacedName) ([]nropv1.NamespacedName, bool, error) {
Expand Down

0 comments on commit 4cb9131

Please sign in to comment.