diff --git a/controllers/datasciencecluster/datasciencecluster_controller.go b/controllers/datasciencecluster/datasciencecluster_controller.go index 5e522e335a5..af00a344e73 100644 --- a/controllers/datasciencecluster/datasciencecluster_controller.go +++ b/controllers/datasciencecluster/datasciencecluster_controller.go @@ -254,6 +254,7 @@ func (r *DataScienceClusterReconciler) Reconcile(ctx context.Context, req ctrl.R status.SetCompleteCondition(&saved.Status.Conditions, status.ReconcileCompletedWithComponentErrors, fmt.Sprintf("DataScienceCluster resource reconciled with component errors: %v", componentErrors)) saved.Status.Phase = status.PhaseReady + saved.Status.Release = currentOperatorRelease }) if err != nil { log.Error(err, "failed to update DataScienceCluster conditions with incompleted reconciliation") @@ -270,6 +271,7 @@ func (r *DataScienceClusterReconciler) Reconcile(ctx context.Context, req ctrl.R instance, err = status.UpdateWithRetry(ctx, r.Client, instance, func(saved *dscv1.DataScienceCluster) { status.SetCompleteCondition(&saved.Status.Conditions, status.ReconcileCompleted, "DataScienceCluster resource reconciled successfully") saved.Status.Phase = status.PhaseReady + saved.Status.Release = currentOperatorRelease }) if err != nil { diff --git a/controllers/dscinitialization/dscinitialization_controller.go b/controllers/dscinitialization/dscinitialization_controller.go index 56033a9a470..37991131cb5 100644 --- a/controllers/dscinitialization/dscinitialization_controller.go +++ b/controllers/dscinitialization/dscinitialization_controller.go @@ -152,6 +152,20 @@ func (r *DSCInitializationReconciler) Reconcile(ctx context.Context, req ctrl.Re } } + // upgrade case to update release version in status + if !instance.Status.Release.Version.Equals(currentOperatorRelease.Version.Version) { + message := "Updating DSCInitialization status" + instance, err := status.UpdateWithRetry(ctx, r.Client, instance, func(saved *dsciv1.DSCInitialization) { + saved.Status.Release = currentOperatorRelease + }) + if err != nil { + log.Error(err, "Failed to update release version for DSCInitialization resource.", "DSCInitialization", req.Namespace, "Request.Name", req.Name) + r.Recorder.Eventf(instance, corev1.EventTypeWarning, "DSCInitializationReconcileError", + "%s for instance %s", message, instance.Name) + return reconcile.Result{}, err + } + } + // Check namespace is not exist, then create namespace := instance.Spec.ApplicationsNamespace err := r.createOdhNamespace(ctx, instance, namespace, platform)