check setup job success before upgrading deployment
[ZITADOPER-7]
This commit is contained in:
@@ -349,9 +349,14 @@ func (r *ZitadelClusterReconciler) reconcileSetupJob(ctx context.Context, zitade
|
|||||||
if err := r.Create(ctx, desiredSetupJob); err != nil {
|
if err := r.Create(ctx, desiredSetupJob); err != nil {
|
||||||
return ctrl.Result{}, fmt.Errorf("error creating new SetupJob: %v", err)
|
return ctrl.Result{}, fmt.Errorf("error creating new SetupJob: %v", err)
|
||||||
}
|
}
|
||||||
return ctrl.Result{}, nil
|
}
|
||||||
|
if err := r.Get(ctx, key, &existingJob); err != nil {
|
||||||
|
return ctrl.Result{}, fmt.Errorf("error fetching existing SetupJob status: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if existingJob.Status.Succeeded != 1 { // Replace with actual success condition
|
||||||
|
return ctrl.Result{}, fmt.Errorf("SetupJob is not successful, current status: %v", existingJob.Status)
|
||||||
|
}
|
||||||
// If the job exists and the image matches, no action is needed
|
// If the job exists and the image matches, no action is needed
|
||||||
return ctrl.Result{}, nil
|
return ctrl.Result{}, nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user