Skip to content

Commit

Permalink
Fix DIC returned reconcile.Result for ImageStream
Browse files Browse the repository at this point in the history
regression introduced in kubevirt#2700

Signed-off-by: Arnon Gilboa <agilboa@redhat.com>
  • Loading branch information
arnongilboa authored and kubevirt-bot committed Jul 28, 2023
1 parent 507caf1 commit c57ab57
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
9 changes: 5 additions & 4 deletions pkg/controller/dataimportcron-controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,13 +394,14 @@ func (r *DataImportCronReconciler) update(ctx context.Context, dataImportCron *c
return res, err
}

// We use the poller returned reconcile.Result for RequeueAfter if needed
// skip if we disabled schedule
// Skip if schedule is disabled
if isImageStreamSource(dataImportCron) && dataImportCron.Spec.Schedule != "" {
res, err := r.pollImageStreamDigest(ctx, dataImportCron)
// We use the poll returned reconcile.Result for RequeueAfter if needed
pollRes, err := r.pollImageStreamDigest(ctx, dataImportCron)
if err != nil {
return res, err
return pollRes, err
}
res = pollRes
}

desiredDigest := dataImportCron.Annotations[AnnSourceDesiredDigest]
Expand Down
4 changes: 3 additions & 1 deletion pkg/controller/dataimportcron-controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -614,8 +614,10 @@ var _ = Describe("All DataImportCron Tests", func() {
imageStream := newImageStream(imageStreamName)
imageStream.Status.Tags = imageStream.Status.Tags[imageStreamTagsFromIndex:]
reconciler = createDataImportCronReconciler(cron, imageStream)
_, err := reconciler.Reconcile(context.TODO(), cronReq)
res, err := reconciler.Reconcile(context.TODO(), cronReq)
Expect(err).ToNot(HaveOccurred())
Expect(res.Requeue).To(BeTrue())
Expect(res.RequeueAfter.Seconds()).To(And(BeNumerically(">", 0), BeNumerically("<=", 60)))

err = reconciler.client.Get(context.TODO(), cronKey, cron)
Expect(err).ToNot(HaveOccurred())
Expand Down

0 comments on commit c57ab57

Please sign in to comment.