fix: record bundle placements when scheduling ends with a warning

The bundle placement record was only saved on plain success, not on warnings. Moving such a workload left the old ManifestWork behind. The app ran on both clusters, and the CR was stuck in SchedulingInProgress. Same scenario after a scheduler restart. The record is now saved before any final status.

Resolves: #16 (closed)

Merge request reports

Loading
+4 −1
Changes for src/ocm_scheduler_operator/internal/controller/hyposchedulingmanifest_controller.go: 4 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -577,6 +577,10 @@ func (r *HypoSchedulingManifestReconciler) Reconcile(ctx context.Context, req ct
		}
	}

	// Record where each bundle was placed, whatever final status follows
	// the next reconciliation needs it to delete the ManifestWork of a bundle that moves to another cluster
	r.Bundles[hypoSchedulingManifest.Name] = bundles

	connections, err := r.getNetworkConnections(bundles)
	if err != nil {
		log.Error(err, "Error occurred while retrieving network connections")
@@ -659,7 +663,6 @@ func (r *HypoSchedulingManifestReconciler) Reconcile(ctx context.Context, req ct
		return ctrl.Result{}, fmt.Errorf("%w", err)
	}

	r.Bundles[hypoSchedulingManifest.Name] = bundles
	log.Info("Reconciliation complete")
	return ctrl.Result{}, nil
}
Loading