diff --git a/pkg/backup/backup/backup_manager.go b/pkg/backup/backup/backup_manager.go index bf27564193..a8760d8fd5 100644 --- a/pkg/backup/backup/backup_manager.go +++ b/pkg/backup/backup/backup_manager.go @@ -29,7 +29,6 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" batchlisters "k8s.io/client-go/listers/batch/v1" corelisters "k8s.io/client-go/listers/core/v1" - glog "k8s.io/klog" ) type backupManager struct { @@ -83,16 +82,14 @@ func (bm *backupManager) syncBackupJob(backup *v1alpha1.Backup) error { err := backuputil.ValidateBackup(backup) if err != nil { - uErr := bm.statusUpdater.Update(backup, &v1alpha1.BackupCondition{ + bm.statusUpdater.Update(backup, &v1alpha1.BackupCondition{ Type: v1alpha1.BackupInvalid, Status: corev1.ConditionTrue, Reason: "InvalidSpec", Message: err.Error(), }) - if uErr != nil { - glog.Warningf("Update condition %s failed for backup %s/%s", v1alpha1.BackupInvalid, ns, name) - } - return nil + + return controller.IgnoreErrorf("invalid backup spec %s/%s", ns, name) } _, err = bm.jobLister.Jobs(ns).Get(backupJobName) diff --git a/pkg/controller/backup/backup_controller.go b/pkg/controller/backup/backup_controller.go index 9ebfad539b..dd2ec48e1a 100644 --- a/pkg/controller/backup/backup_controller.go +++ b/pkg/controller/backup/backup_controller.go @@ -143,10 +143,13 @@ func (bkc *Controller) processNextWorkItem() bool { if err := bkc.sync(key.(string)); err != nil { if perrors.Find(err, controller.IsRequeueError) != nil { glog.Infof("Backup: %v, still need sync: %v, requeuing", key.(string), err) + bkc.queue.AddRateLimited(key) + } else if perrors.Find(err, controller.IsIgnoreError) != nil { + glog.V(4).Infof("Backup: %v, ignore err: %v", key.(string), err) } else { utilruntime.HandleError(fmt.Errorf("Backup: %v, sync failed, err: %v, requeuing", key.(string), err)) + bkc.queue.AddRateLimited(key) } - bkc.queue.AddRateLimited(key) } else { bkc.queue.Forget(key) }