From 7cbcb8807f2819c5cc931fc155aa6c34f45bdcec Mon Sep 17 00:00:00 2001 From: aceking Date: Wed, 29 Jun 2022 16:01:10 +0800 Subject: [PATCH] =?UTF-8?q?controllers:=20when=20name=20over=2063,=20write?= =?UTF-8?q?=20error=20message=20in=20backup=20status=20=E2=80=A6=20(#560)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit controllers: when name over 63, write error message in backup status #553 --- controllers/backup_controller.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/controllers/backup_controller.go b/controllers/backup_controller.go index 1bc26499..45685a88 100644 --- a/controllers/backup_controller.go +++ b/controllers/backup_controller.go @@ -85,7 +85,13 @@ func (r *BackupReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctr jobSyncer := backupSyncer.NewJobSyncer(r.Client, r.Scheme, backup) if err := syncer.Sync(ctx, jobSyncer, r.Recorder); err != nil { - return reconcile.Result{}, err + backup.UpdateStatusCondition(apiv1alpha1.BackupFailed, corev1.ConditionTrue, "CreateFailure", err.Error()) + backup.Status.Completed = true + if err2 := r.updateBackup(savedBackup, backup); err2 != nil { + return reconcile.Result{}, err2 + } + // Do not try again. + return reconcile.Result{}, nil } if err = r.updateBackup(savedBackup, backup); err != nil {