Skip to content

Commit c72b4e3

Browse files
committed
Retry failed verifications with exponential backoff
Signed-off-by: Stefan Prodan <[email protected]>
1 parent 082028e commit c72b4e3

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

controllers/ocirepository_controller.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -409,11 +409,16 @@ func (r *OCIRepositoryReconciler) reconcileSource(ctx context.Context, obj *sour
409409
}
410410
}()
411411

412-
// Verify artifact
412+
// Verify artifact if:
413+
// - the upstream digest differs from the one in storage (revision drift)
414+
// - the OCIRepository spec has changed (generation drift)
415+
// - the previous reconciliation resulted in a failed artifact verification (retry with exponential backoff)
413416
if obj.Spec.Verify == nil {
414417
// Remove old observations if verification was disabled
415418
conditions.Delete(obj, sourcev1.SourceVerifiedCondition)
416-
} else if !obj.GetArtifact().HasRevision(revision) || conditions.GetObservedGeneration(obj, sourcev1.SourceVerifiedCondition) != obj.Generation {
419+
} else if !obj.GetArtifact().HasRevision(revision) ||
420+
conditions.GetObservedGeneration(obj, sourcev1.SourceVerifiedCondition) != obj.Generation ||
421+
conditions.IsFalse(obj, sourcev1.SourceVerifiedCondition) {
417422
provider := obj.Spec.Verify.Provider
418423
err := r.verifyOCISourceSignature(ctx, obj, url, keychain)
419424
if err != nil {
@@ -422,7 +427,6 @@ func (r *OCIRepositoryReconciler) reconcileSource(ctx context.Context, obj *sour
422427
sourcev1.VerificationError,
423428
)
424429
conditions.MarkFalse(obj, sourcev1.SourceVerifiedCondition, e.Reason, e.Err.Error())
425-
conditions.MarkFalse(obj, meta.ReconcilingCondition, e.Reason, e.Err.Error())
426430
return sreconcile.ResultEmpty, e
427431
}
428432

0 commit comments

Comments
 (0)